Post to friends timeline using the feed dialog example c# api - facebook

I am trying to post something on my friend's timeline and I keep on getting an error every time i try to do it. the code i am using is below. i wonder if the code is correct? Cause it doesn't work for me. Can you help?
dynamic parameters = new ExpandoObject();
if (!string.IsNullOrEmpty(action.Post.PictureLocalSource))
{
var pictureTracking = GetNextPhotoFromFolder(action.Post.PictureLocalSource);
if (pictureTracking != null)
{
// action.Post.Picture = pictureTracking.FBPictureRef; // org
action.Post.Link = pictureTracking.FBPictureRef;
action.Post.Picture = pictureTracking.TrackingFileName;
parameters.type = "";
}
}
parameters.to = action.FacebookPostTargetID;
//parameters.Add("from", MyFacebookID);
parameters.message=action.Post.Message.Trim();
parameters.link = action.Post.Link;
parameters.picture = action.Post.Picture;
parameters.source = action.Post.Source;
parameters.name = action.Post.Name;
string caption = action.Post.Caption;
if (caption.Length > 200)
caption = caption.Substring(0, 200);
parameters.caption = caption.Trim(); // "Σχετικά με το asfame.gr";
parameters.description=action.Post.Description;
string feedtype = "";
if (action.Type == ActionType.Comments)
feedtype = "comments";
else
feedtype = "feed";
parameters.method = feedtype;
result = Client.Post(parameters);

Facebook has removed the ability to post on friends wall from 6th feb,2013. checkout the official doc here http://developers.facebook.com/roadmap/completed-changes/ under subsection Removing ability to post to friends walls via Graph API from February 6, 2013 changes. Hope it helps.

Related

Using [google-text-to-speech] v1Beta1 version in c#

Does any one know how to use the V1Beta1 version in c#. It will be a great help if some one can point me to some example. Google has not created a Client for this version.
https://cloud.google.com/text-to-speech/docs/reference/rest/v1beta1/text/synthesize#TimepointType
I had the same problem (for Google.Apis.Texttospeech.v1) and could not find an example anywhere. I pieced it together from some Ruby Api docs, so, this works for me.
How to use Google.Apis.Texttospeech.v1 in C#:
var request = new Google.Apis.Texttospeech.v1.Data.SynthesizeSpeechRequest();
request.AudioConfig = new Google.Apis.Texttospeech.v1.Data.AudioConfig()
{
AudioEncoding = "Linear16" // = WAV, or "MP3", "OGG_OPUS"
};
request.Input = new Google.Apis.Texttospeech.v1.Data.SynthesisInput
{
Text = "Sample Speaker Text" // Or use Ssml = "<speak> Your SSML Text.
</speak>"
};
request.Voice = new Google.Apis.Texttospeech.v1.Data.VoiceSelectionParams
{
LanguageCode = "en-EN",
Name = "en-US-Wavenet-C"
};
var service = new Google.Apis.Texttospeech.v1.TexttospeechService(new
Google.Apis.Services.BaseClientService.Initializer
{
ApplicationName = "My Sample App",
ApiKey = "[Your API Key]"
}
);
var response = service.Text.Synthesize(request).Execute();
using (var output = System.IO.File.Create("audioclip.wav"))
{
var bytes = System.Convert.FromBase64String(response.AudioContent);
output.Write(bytes, 0, bytes.Length);
}

Inserting current date into confluence hyperlink

I am using this code to display current date in the confluence page.
{run-now:dateFormat =d-MMM-yyyy}
$current_time
{run-now}
My purpose, to include this date into email hyperlink, like below
[Click me|mailto: some_email#domen.com &subject=Update as of - {run-now:dateFormat =d-MMM-yyyy} $current_time{run-now}]
My expectations, is that it will show mailto link after clicking which, it will open email with subject that is including current date.
But this is working unexpectedly
it shows me something like this instead of the link
function run_moreDisplayToggle_1() { // toggle display of "more" rows of parameter table on or of //alert("test"); var table = document.getElementById("run_table_1"); var rows = table.getElementsByTagName("tr"); var isMoreFound = false; for (var i = 0; i < rows.length; i++) { var row = rows.item(i); if (row.id.match("1_row_")) { if (row.style.display == "none") { row.style.display = ""; isMoreFound = true; } else { row.style.display = "none"; } } } var icon = document.getElementById("run_1_advanced_toggle"); var moreElement = document.getElementById("run_1__more") if (isMoreFound) { icon.src = "/images/icons/subtract_12.gif"; icon.title = "Less"; moreElement.value = "true"; } else { icon.src = "/images/icons/add_12.gif"; icon.title = "More"; moreElement.value = "false"; } }
29-Jan-2014" class="external-link" rel="nofollow">Click me
It's better you use HTML Macro to hyperlink your email.
I think it should be something like this:
{html}<a mailto: some_email#domen.com &subject=Update as of - {run-now:dateFormat =d-MMM-yyyy} $current_time{run-now}/a>{html}
Anyway as the confluence expertise always online in Answers I recommend you to check there.

redirecting users according to their group or name in Google Sites

I am trying to make a site using Google Sites, and i need a way to know the user name or group and then redirect them to different pages.
Also if you have any Google script that can help, that will be great too, thanks.
This is a very simple answer but it can help.
We just need to get the user ID and compare it to the list of authorized users, if user is in the list then a link is created, if not, a label is created telling the user they need permission.
I don't need more than that for now, but in the future 2 more features can be cool to add:
1- using group names instead of an array with users to be more dynamic. (i don't know how yet)
2- auto redirect user instead of displaying a link. (i think that can be easy)
function doGet() {
var app = UiApp.createApplication();
var arr = new Array(4);
arr[0] = "user_001#company.com";
arr[1] = "user_002#company.com";
arr[2] = "user_003#company.com";
arr[3] = "user_004#company.com";
for (var i = 0; i < arr.length; i++) {
if (Session.getActiveUser().getUserLoginId() == arr[i]){
var label = app.createLabel('User: ' + Session.getActiveUser().getUserLoginId() + ', You have permission :)');//false
var link = app.createAnchor('Here is your link', 'http://www.umich.edu').setId("link").setVisible(true);//false
var flag = 1;
break;
//#####################
} else {
var label = app.createLabel('You need permission :(');//false
var flag = 0;
}
}
app.add(label);
if (flag == 1){app.add(link);}
return app;
}

ga:landingPagePath Issue

I need help getting the landingpage for a session using google analytics ga:landingPagePath.
When i use the query below I get the correct result with my first visit using IE. However, when I close IE and open Firefox and visit a different landing page, I still get the landing page of the previous session. I should get the landing page of the current firefox session unless since this is a new browser session. Thanks in advance for any help.
// query google analytics
var query1 = new Google.GData.Analytics.DataQuery(dataFeedUrl);
query1.Ids = string.Format("ga:{0}", profileId);
query1.Metrics = "ga:entrances";
query1.Dimensions = "ga:landingPagePath";
//query1.Filters = "ga:entrances==1";
//query.Filters = string.Format("ga:pagePath=={0}", url);
// set from and to date (google does not accept datetime min/max value)
string fromDate = DateTime.Today.ToString("yyyy-MM-dd");
query1.GAStartDate = fromDate;
query1.GAEndDate = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd");
var dataFeed = service.Query(query1);
if (dataFeed != null && dataFeed.Entries != null && dataFeed.Entries.Count > 0)
{
var dataEntries = dataFeed.Entries.Last() as Google.GData.Analytics.DataEntry;
var landingPage = dataEntries;
result = landingPage.Dimensions.Last().Value.ToString();
HttpContext.Current.Session["landing"] = result.ToString();
}
return result;
}

share link facebook update status wall using c#(facebook SDK)

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.