Facebook posts not showing on timeline - c#

I have created webapp in .Net MVC which shares post on Facebook. Here is the code of sharing post
var fb = new FacebookClient(facebookAccessToken);
var argList = new Dictionary<string, object>();
argList["name"] = postName;
argList.Add("picture", postImageUrl);
argList["link"] = postUrl;
var actions = new[] { new { name = "More Details", link = morePostDetailsUrl } }.ToList();
argList["actions"] = JsonConvert.SerializeObject(actions);
var postResult = fb.Post("<facebookuserId>/feed", argList);
Now i am able to post this feed successfully but these posts are not being displayed on timeline. I have checked all permission & they are set to public. Also i can see them in activity logs & on Home screen when i logs in.
How to post a feed so that it can be displayed on timeline automatically ?
Also i am using actions, are these actions being deprecated or do i need to submit them for review before going live ?
Please guide me if anyone has some idea on the above.
Thanks

Related

Invite email do not sent to non google account when sharing a calendar

C# package used: Google.Apis.Calendar.v3
I am making a sharing a calendar to an not google account.
No invite notification sent to that account event the Response = OK
var rule = new AclRule
{
Role = "owner",
Scope = new AclRule.ScopeData
{
Value = acb#yahoo.com,
Type = "user"
}
};
var service = await GetCalendarService();
var request = service.Acl.Insert(rule, calendarId);
request.SendNotifications = true;
AclRule addedRule = await request.ExecuteAsync();
So could anybody help me about that?
Thanks,
I found that google calendar API dont have any options to send notification to non google email.
Moreover, the calendar must be made as public first. This one can not modify by API. And I dont want to make it as public also.
Here's document from google

Post message with Facebook SDK .NET

I have created a facebook page and a facebook application for my website and now I need to post messages onto the facebook page with help of facebook SDK .NET.
This is what I got so far :
public static bool UploadPost(string message)
{
dynamic result;
//https://developers.facebook.com/tools/explorer/
//https://developers.facebook.com/tools/access_token/
FacebookClient client = new FacebookClient("secret access token");
result = client.Get("oauth/access_token", new
{
client_id = "[Client ID number]",
client_secret = "[Client sercret",
grant_type = "client_credentials",
});
result = client.Post("[facebook app Id]/feed", new { message = "Test Message from app" });
//result.id;
result = client.Get("[facebook app Id]");
return false;
}
When running this I get : Additional information: (OAuthException - #200) (#200) The user hasn't authorized the application to perform this action on client.Post. If I remove the client.Post row every thing works good, the correct data is fetched.
I have tried follow some helps on facebook SDK .NET website but it is still not working.
The main problem now is that I get permission exception. I was hoping that my facebook app hade enouth permissions to publish post from my website to the facebook page.
Here is a step wise tutorial to register your application with facebook and get an app Id for your application.
Then for permissions ::
private const string ExtendedPermissions = "user_about_me,read_stream,publish_stream";
This is a string of permissions. Pass it on further for getting correct permissions to post messages on page. Post using your standard code for posting no FB pages.
Cheers. Hope it helps.
Are you trying to post to [facebook app id]?
I would recomend to post to "me/feed" and test if that works.
Also, to post to Facebook you have to have the publish_stream permission
private async Task Authenticate()
{
string message = String.Empty;
try
{
session = await App.FacebookSessionClient.LoginAsync("user_about_me,read_stream,publish_actions");
App.AccessToken = session.AccessToken;
App.FacebookId = session.FacebookId;
Dispatcher.BeginInvoke(() => NavigationService.Navigate(new Uri("/Pages/LandingPage.xaml", UriKind.Relative)));
}
catch (InvalidOperationException e)
{
message = "Login failed! Exception details: " + e.Message;
MessageBox.Show(message);
}
}
Should work :)
The following should work.
var fb = new FacebookClient("access_token");
fb.PostCompleted += (o, e) => {
if(e.Error == null) {
var result = (IDictionary<string, object>)e.GetResultData();
var newPostId = (string)result.id;
}
};
var parameters = new Dictionary<string, object>();
parameters["message"] = "My first wall post using Facebook SDK for .NET";
fb.PostAsync("me/feed", parameters);
This was taken directly from the documentation.
By creating a extended page token and use it to make the post everything works just fine. See this : How to get Page Access Token by code?
Im surprised that this simple task was so hard to get running and that there was vary little help to get.

how to hide/unhide on facebook posts and comments

My question is: How can I hide posts and comments using Facebook SDK in C# ?
and I tried this:
var client = new FacebookClient(access_token);
client.Delete("postId/hidden");
client.Post("postId/hidden");
or:
client.Delete("postId", new { is_visible = true });
client.Post("postId", new { is_visible = true });
but both of them don't work.
Thanks.
At the moment, the Facebook API only allows to delete/hide the user's posts not friends nor other feeds

PayPal Express Checkout SOAP API: Refunds

I use the PayPal Express Checkout SOAP service. For example here's a trimmed down version of the code to redirect the user to PayPal Sandbox when checking out:
var client = new PayPalAPIAAInterfaceClient();
var credentials = new CustomSecurityHeaderType() {
Credentials = new UserIdPasswordType() { ... }
};
var paymentDetails = new PaymentDetailsType() {
OrderTotal = new BasicAmountType() {
Value = string.Format("{0:0.00}", 100m)
}
};
var request = new SetExpressCheckoutReq() {
SetExpressCheckoutRequest = new SetExpressCheckoutRequestType() {
SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType() {
PaymentDetails = new PaymentDetailsType[] { paymentDetails },
CancelURL = "http://www.mysite.com" + Url.Action("Cancelled", "PayPalCheckout"),
ReturnURL = "http://www.mysite.com" + Url.Action("Index", "PayPalCheckout")
},
Version = "60.0"
}
};
var response = client.SetExpressCheckout(ref credentials, request);
return Redirect(string.Format("{0}?cmd=_express-checkout&token={1}", "https://www.sandbox.paypal.com/cgi-bin/webscr", response.Token));
I then handle the data when the user is returned to the ReturnUrl. This was taken from some code I found on another website.
I now need to add a refund facility to my site. I was wondering if anyone else has done this? I've tried searching online but can't seem to find anything that helps. I also tried doing it myself but the API isn't very intuitive.
I'd appreciate the help. Thanks
It would just need to be a RefundTransaction API call that you would need to execute. Are you trying to have your return page issue a refund based on a condition, or are you trying to create a GUI type of interface to allow someone to issue a refund for a transaction? Have you looked at the code samples for this within the SDK's that PayPal offers? You should be able to use this code.

Facebook C# SDK - Mobile Web Page : Facebook Wall Post URL Redirect

I am currently working on a mobile web page in asp.Net MVC2 that allows users to post to their walls. I have the following code that posts to the user's wall, but would like to instead have a redirect to Facebook's mobile "Post To my Wall" view to allow the user to add to the posted message and submit with a "Post" button or "Cancel". Do I have to recreate this view myself? It seems like something that a lot of sites would use.
public string PostToWall(string code)
{
string authToken = string.Empty;
try
{
authToken = GetAuthToken(code);
FacebookClient app = new FacebookClient(authToken);
dynamic user = app.Get("me");
var id = user.id;
var args = new Dictionary<string, object>();
args["message"] = "Test Wall Post";
args["caption"] = "Test Caption";
args["description"] = "Test Description";
args["name"] = "Test Name";
//args["picture"] = "[your image URL]";
//args["link"] = "[your link URL]";
app.Post("/me/feed", args);
return string.Empty;
}
catch (Exception ex)
{
_log.ErrorFormat("Error getting the Facebook authentication token. {0}", ex);
return string.Empty;
}
}
Thanks!
[Edit] #OffBySome I set up a rough test using the facebook Javascript SDK and I set it to display: 'touch' but it still pops up in my safari iphone user agent. I used this
attachment: {
title: '<my title>',
caption: '<my caption>',
description: (
<my description>
),
name: '<name>',
link: '<link>',
display: 'touch', },
But none of these attachments get added to my wall posts. Am I doing it wrong? Dialogs: Fb.Ui http://developers.facebook.com/docs/reference/javascript/#xfbml
Easiest for this would be to use the Facebook javascript sdk and use the FB.ui dialog to allow the user to share. You can set display=touch or display=wap for a mobile optimized dialog.

Categories