I cannot set the privacy while creating a new Album in fb using facebook-c#-sdk 5.0.25
var albumDetails = new Dictionary<string, object>();
albumDetails.Add("name", "test name");
albumDetails.Add("description", "test description");
albumDetails.Add("privacy", "ALL_FRIENDS"); // I get an error here,
//Invalid Privacy value
var fbResult = fb.Post("me/albums", albumDetails);
I tried setting to other values like "EVERYONE" but without success. Please let me know what is the correct set of values.
Thanks,
Partha
According to this page, it should be a json encoded value something like (i suppose): [value: 'ALL_FRIENDS'] or {value: 'ALL_FRIENDS'}
This works for me :-
dynamic parameters = new ExpandoObject();
parameters.name = theName;
parameters.privacy = "{'value':'" + theValue + "'}";
Related
Using script I replaced body txt in a copied doc. I want to get that doc id and send that via email automatically after doc was created. Not sure if its possible but my current code is below. Please help.
var templateFile = DriveApp.getFileById("1baIoahNT9YJ84mnUcp1pyWR0U5v235z29vPCkiv4rIc");
var templateResponseFolder = DriveApp.getFolderById("1mmFKjNnbTy2k8ZWobtcvdtIcwyse3NVd");
var copy = templateFile.makeCopy(deptName + " " + "Cost Recovery Agreement", templateResponseFolder);
var doc = DocumentApp.openById(copy.getId());
var body = doc.getBody();
body.replaceText("{{DeptName}}", deptName);
body.replaceText("{{DeptCo}}", deptCo);
body.replaceText("{{FirstName}}", firstName);
body.replaceText("{{LastName}}", lastName);
doc.saveAndClose();
var id = doc.getId();
var subject = "Welcome to ResponseMaster!";
var message = title + " " + lastName + "," + "\n\n" + "Thank you for choosing ResponseMaster as your dedicated software for your fire department.";
var costRecoveryForm = DriveApp.getFileById();
MailApp.sendEmail(userEmail, subject, message, { attachments: [costRecoveryForm] });
I am already have the e.values set up properly further above the script but this is all the script that deals with the issue.
By putting the Google Doc URL in the email body, Gmail will show it as an attachment (if the recipient has access to the file).
Like in the following image.
So here is my approach:
let templateFile = DriveApp.getFileById("1hNJ8SUybJn8nnJg87Pm22dzI0_3L0N17ZbYhV1HeUrM");
let templateResponseFolder = DriveApp.getFolderById("1Xzs1k-e8q2NYCTHg-4yit7zFWTF7L33h");
let copy = templateFile.makeCopy(`${deptName} Cost Recovery Agreement`, templateResponseFolder);
let copyId = copy.getId();
// Here I give the user permission to view the file I'm sending him
DriveApp.getFileById(copyId).addViewer(userEmail);
let doc = DocumentApp.openById(copyId);
let copyUrl = doc.getUrl();
let body = doc.getBody();
body.replaceText("{{DeptName}}", deptName);
body.replaceText("{{DeptCo}}", deptCo);
body.replaceText("{{FirstName}}", firstName);
body.replaceText("{{LastName}}", lastName);
doc.saveAndClose();
let subject = "Welcome to ResponseMaster!";
let message = `${title} ${lastName},\n\nThank you for choosing ResponseMaster as your dedicated software for your fire department.\n\n${copyUrl}`;
MailApp.sendEmail(userEmail, subject, message);
On CRM 2013 on-premise, I'm trying to write a plugin that triggers when an update is made to a field on Quote. The plugin then creates a new custom entity "new_contract".
My plugin is successfully triggered when the update to that field is made. However I keep getting an error message "The given key was not present in the dictionary" when trying to create the new custom entity.
I'm using a "PostImage" in this code. I confirm that it's registered using the same name in Plugin Registration.
Here is the code
var targetEntity = context.GetParameterCollection<Entity>
(context.InputParameters, "Target");
if (targetEntity == null)
{throw new InvalidPluginExecutionException(OperationStatus.Failed,
"Target Entity cannot be null")}
var postImage = context.PostEntityImages["PostImage"];
if (postImage == null)
{throw new InvalidPluginExecutionException(OperationStatus.Failed,
"Post Image is required");}
var quote = context.GenerateCompositeEntity(targetEntity, postImage);
//throw new InvalidPluginExecutionException(OperationStatus.Failed, "Update is captured");
//Guid QuoteId = (Guid)quote.Attributes["quoteid"];
var serviceFactory = (IOrganizationServiceFactory)serviceProvider
.GetService(typeof(IOrganizationServiceFactory));
var service = serviceFactory.CreateOrganizationService(context.UserId);
var contractEntity = new Entity();
contractEntity = new Entity("new_contract");
if (quote.Attributes.Contains("portfolio"))
{
var quotePortfolio = (EntityReference)quote.Attributes["new_portfolio];
contractEntity[Schema.new_contract.PortfolioName] =
new EntityReference(quotePortfolio.LogicalName, quotePortfolio.Id);
}
if (quote.Attributes.Contains(Schema.Quote.QuoteName))
{
var quoteName = (string)quote.Attributes["name"];
contractEntity[Schema.new_contract.contractName] = quoteName;
}
var contractId = service.Create(contractEntity);
I think context does not contain "PostImage" attribute.You should check context to see whether it contains the attribute before getting the data.
Looking at this line in your post above:
var service = serviceFactory.CreateOrganizationService(context.UserId);
I am deducing that the type of your context variable is LocalPluginContext (since this contains the UserId value) which does not expose the images (as another answer states).
To access the images, you need to get to the Plugin Execution Context:
IPluginExecutionContext pluginContext = context.PluginExecutionContext;
Entity postImage = null;
if (pluginContext.PostEntityImages != null && pluginContext.PostEntityImages.Contains("PostImage))
{
postImage = pluginContext.PostEntityImages["PostImage"];
}
In the below code segment, you are checking for the attribute "portfolio" and using "new_portfolio". Can you correct that and let us know whether that worked.
if (quote.Attributes.Contains("portfolio"))
{
var quotePortfolio = (EntityReference)quote.Attributes["new_portfolio];
contractEntity[Schema.new_contract.PortfolioName] = new EntityReference(quotePortfolio.LogicalName, quotePortfolio.Id);
}
First, you don't say what line is throwing the exception. Put in the VS debugger and find the line that is throwing the exception.
I did see that you are trying to read from a dictionary here without first checking if the dictionary contains the key, that can be the source of this exception.
var postImage = context.PostEntityImages["PostImage"];
if (postImage == null)
throw new InvalidPluginExecutionException(OperationStatus.Failed,
"Post Image is required");
Try this:
if(!context.PostEntityImages.Contains("PostImage") ||
context.PostEntityImages["PostImage"] == null)
InvalidPluginExecutionException(OperationStatus.Failed, "Post Image is required");
var postImage = context.PostEntityImages["PostImage"];
Although, I don't think that a PostEntityImage Value will ever be null, if it passes the Contains test you don't really need the null check.
I tried to follow the tutorial “Integrating Parse-Facebook in Unity” at: https://www.parse.com/tutorials/integrating-facebook-in-unity
Everything works fine but when I want to add user’s email, gender, name, birthday and location. , by using the following method :
private IEnumerator saveUserProfile(Dictionary<string, string> profile) {
var user = ParseUser.CurrentUser;
user["profile"] = profile;
user["email"] = profile["email"] ;
user["gender"] = profile["gender"] ;
user["name"] = profile["name"] ;
user["birthday"] = profile["birthday"] ;
user["location"] = profile["location"] ;
// Save if there have been any updates
if (user.IsKeyDirty("profile")) {
var saveTask = user.SaveAsync();
while (!saveTask.IsCompleted) yield return null;
UpdateProfile();
}
}
The only value added is “gender” and the other values were NOT created. Please see the below screenshot:
Also , when I presses on Facebook :” Profile No.” row in “authData” column in Parse database side , the Facebook website open with the following message :
Profile Unavailable
Sorry, this profile is not available at the moment. Please try again shortly
Please what I can do to add the above values and to get the correct profile no. for the users
Thank you
Waheed
try to check your dictionary what are the things being stored.
foreach( KeyValuePair<string, string> kvp in profile)
{
Debug.Log("Key = " + kvp.Key + " Value = " + kvp.Value);
}
I'm trying to query invoices using the .NET IPP DevKit v3.
Following all the directions found on the documentation site, I can query invoices and add skip/take/order by/where/etc to the query when using ONLY default fields. But, as soon as I add non-default fields, skip/take/order by/where/etc does NOT seem to work.
Here's the error:
System.ArgumentException was unhandled
HResult=-2147024809
Message=Expression of type 'System.Collections.Generic.IEnumerable`1[<>f__AnonymousType0`3[Intuit.Ipp.Data.Invoice,Intuit.Ipp.Data.Line[],Intuit.Ipp.Data.LinkedTxn[]]]' cannot be used for parameter of type 'System.Linq.IQueryable`1[<>f__AnonymousType0`3[Intuit.Ipp.Data.Invoice,Intuit.Ipp.Data.Line[],Intuit.Ipp.Data.LinkedTxn[]]]' of method 'System.Linq.IQueryable`1[<>f__AnonymousType0`3[Intuit.Ipp.Data.Invoice,Intuit.Ipp.Data.Line[],Intuit.Ipp.Data.LinkedTxn[]]] Skip[<>f__AnonymousType0`3](System.Linq.IQueryable`1[<>f__AnonymousType0`3[Intuit.Ipp.Data.Invoice,Intuit.Ipp.Data.Line[],Intuit.Ipp.Data.LinkedTxn[]]], Int32)'
Source=System.Core
What am I missing here?
Code:
string AppToken = "your AppToken goes here";
string AppConsumerKey = "your AppConsumerKey goes here";
string AppConsumerKeySecret = "your AppConsumerKeySecret goes here";
string AccessToken = "your AccessToken goes here";
string AccessTokenSecret = "your AccessTokenSecret goes here";
string RealmCompanyId = "your RealmId goes here";
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(AccessToken, AccessTokenSecret, AppConsumerKey, AppConsumerKeySecret);
ServiceContext context = new ServiceContext(AppToken, RealmCompanyId, IntuitServicesType.QBD, oauthValidator);
QueryService<Intuit.Ipp.Data.Invoice> qs = new QueryService<Intuit.Ipp.Data.Invoice>(context);
// This works...
var defaultQuery = qs.Select(c => c).Skip(0).Take(10).OrderBy(c => c.Id);
var defaultList = defaultQuery.ToList();
// This works...
var nonDefaultQuery = qs.Select(c => new { c, c.Line, c.LinkedTxn });
var nonDefaultList = nonDefaultQuery.ToList();
// This does NOT work!!
var nonDefaultQueryWithSkip = qs.Select(c => new { c, c.Line, c.LinkedTxn }).Skip(0).Take(10);
var nonDefaultListWithSkip = nonDefaultQueryWithSkip.ToList();
I tried on the API explorer-
Select *,Line.*, LinkedTxn.* FROM Invoice startPosition 1 maxResults 10 (which is your last query) and it works fine but not from .net sdk. I will double check this on the .net SDK and get back to you. Can you verify that you get the correct results on API explorer from this query?
This now works in the latest version (IppDotNetSdkForQuickBooksApiV3.2.0.0)
Here's an example:
QueryService<Intuit.Ipp.Data.Invoice> qs = new QueryService<Intuit.Ipp.Data.Invoice>(context);
string query = string.Format("SELECT *, Line.* FROM Invoice ORDERBY Id STARTPOSITION {0} MAXRESULTS {1}", startPos, pageSize);
var recs = qs.ExecuteIdsQuery(query);
foreach (Intuit.Ipp.Data.Invoice rec in recs)
{
// do stuff...
}
.
I am searching three days but not find solution of my problems. I hope you will help me solve my problems.
I succeeded to post on wall. But there is a problem when I post ds wall nobody (even my friends too) can see my post and not post on update status. Only I can see the wall post. I checked my facebook settings and wall posts property is public.
string[] extendedPermissions = new[] { "publish_stream", "offline_access" };
var fbLoginDialog = new FacebookLoginDialog(appId, extendedPermissions);
fbLoginDialog.ShowDialog();
if (fbLoginDialog.FacebookOAuthResult != null) {
if (fbLoginDialog.FacebookOAuthResult.IsSuccess) {
var fb = new FacebookClient(fbLoginDialog.FacebookOAuthResult.AccessToken);
dynamic result = fb.Get("/me");
string firstName = result.first_name;
string lastName = result.last_name;
string id = result.id;
dynamic parameters = new ExpandoObject();
parameters.message = "Check out this funny article";
parameters.link = "http://www.example.com/article.html";
parameters.picture = "http://www.example.com/article-thumbnail.jpg";
parameters.name = "Article Title";
parameters.caption = "Caption for the link";
parameters.description = "Longer description of the link";
parameters.actions = new { name = "View on Zombo", link = "http://www.zombo.com", };
parameters.privacy = new { value = "ALL_FRIENDS", };
parameters.targeting = new { countries = "US", regions = "6,53", locales = "6", };
dynamic result1 = fb.Post("me/feed", parameters);
I would suggest trying the following:
change parameters.privacy = new { value = "CUSTOM"}; and see if that helps.
be sure the friends are qualified in the targeting list.
be sure your app is not in sandbox mode otherwise, only developers/testers of the app can see the postings from that app.