In Part 1 of this series, I introduced you to the CloudTopia app. In Part 2 we’re going to look at some of the work we did with Open Graph items in CloudTopia.
Here's some quick links to the whole series:
- Intro
- Open Graph
- Web API
- Azure Integration
- Office 365 Integration
- Cortana, Speech and Windows Phone Integration
As I described in Part 1, Yammer Open Graph (OG) items are used in CloudTopia in a couple of different ways: 1) to provide a forum for discussion for the team working on an event and 2) as a way to bring in external discussions from Twitter to the OG item so the team can get a good sense of the external buzz that’s happening around their event…like #yammerofjuly (inside joke for those of you who have been following me on Twitter). As I also described in Part 1, I covered the basic details of working with OG items in a previous post here: http://blogs.technet.com/b/speschka/archive/2014/05/29/using-yammer-open-graph-in-net.aspx. I won’t be covering that all over again, but I will be covering some of the other implementation details and things you should be aware of when working with your own OG items. And that’s really the point of this entire series – not how to write this application per se, but cover some general purpose implementation details and things you should be aware of.
Okay, so we’ll use the blog post above as a starting point for working with OG items, now let’s look at some of the implementation details. In my previous posts on OG I talked about the object model that I created over an OG item and how to use it to create a new OG item in Yammer. For review, here’s what my object model looks like:
To use it you need to send a chunk of JSON to Yammer to create the OG item. What I did to facilitate this is let you create an OG item using my object model, and then when you call the ToString() method I’ve overridden that so that it produces the JSON you need. With that in hand you can use one of the methods I included in my original Yammer and .NET posting to create the item, by calling the MakePostRequest method. The net of this is that your code looks pretty straightforward:
YammerGraphObject go = new YammerGraphObject();
go.Activity.Action = "create";
go.Activity.Actor = new YammerActor("Steve Peschka", "speschka@yammo.onmicrosoft.com");
go.Activity.Message = "This is the discussion page for the " + eventName + " event on " + eventDate;
go.Activity.Users.Add(new YammerActor("Anne Wallace", "annew@yammo.onmicrosoft.com"));
go.Activity.Users.Add(new YammerActor("Garth Fort", "garthf@yammo.onmicrosoft.com"));
YammerGraphObjectInstance jo = new YammerGraphObjectInstance();
jo.Url = Url;
jo.Title = eventName;
jo.Description = "This is the discussion page for the " + eventName + " event on " + eventDate;
jo.Image = "https://socialevents.azurewebsites.net/images/eventplanning.png";
jo.Type = "document";
go.Activity.Object = jo;
string postData = go.ToString();
string response = MakePostRequest(postData, graphPostUrl, yammerAccessToken, "application/json");
The other thing I mentioned in part 2 of that series on OG items is how important it is to have the OG ID; it is required whenever you want to read from or write to the discussions for the OG. As I mentioned in that post there are basically three ways to get the OG ID:
-
Capture it when the OG item is created. You’ll get some JSON back if the create is successful and we can use that to extract out the ID of the newly created item.
-
Search for an OG item. You can search using the Url property of the OG item; however this only returns results if there is at least one discussion item created for the OG. This is another reason why the CloudTopia app creates an initial discussion item when creating the OG.
-
Do a “fake” update to the OG item. What I mean by fake is that I just pass in my own username and email address as the actor, I change the Action to “follow”, and I set the Private property of the Activity to true. When I do that I get back the same chunk of JSON as I do when I create an OG, so again I can extract out the ID from there.
In the case of CloudTopia I simply capture the ID at the time I create the item; that’s clearly the best option if you can do so. In CloudTopia I take the ID of the newly created OG item and I save it to SQL Azure so I can use it later when creating new discussion items for the OG based on tweets I found for the event. To extract the ID I built another class to serialize the JSON into and it looks like this:
Using it is quite simple:
//create the OGO
string response = MakePostRequest(postData, graphPostUrl, yammerAccessToken, "application/json");
if (!string.IsNullOrEmpty(response))
{
YammerGraphObjectItem gi = JsonConvert.DeserializeObject<YammerGraphObjectItem>(response);
}
Finally, remember that you always need the OG ID when reading or writing discussion items for it. Also, the Url to use to read OG discussion items is currently undocumented “officially”, but I have covered all of this in greater detail in part 2 of my series on working with Yammer Open Graph from .NET (http://blogs.technet.com/b/speschka/archive/2014/05/29/using-yammer-open-graph-in-net-part-2.aspx).
Now let’s bring all the discussion of this back around to a concrete example – what we did in the CloudTopia app. Remember that we create a new OG item when a new o365 site is created, and we use the Url for the new o365 site as the key for the OG item. Here’s what that code looks like in CloudTopia:
//NOTE: WILL EXPLAIN MORE OF THIS CODE
//IN A SUBSEQUENT PART OF THIS SERIES
//create a new site
string newUrl = AddNewSite(se.accessToken, se.hostUrl, se.eventName, se.eventDate);
//if it works, plug in the new site url
if (!string.IsNullOrEmpty(newUrl))
{
//create a new GraphObject item
YammerGraphObjectItem gi = CreateOpenGraphItem(newUrl, se.eventName, se.eventDate, se.twitterTags);
The CreateOpenGrahpItem method looks like this:
YammerGraphObjectItem gi = null;
YammerGraphObject go = new YammerGraphObject();
go.Activity.Action = "create";
go.Activity.Actor = new YammerActor("Steve Peschka", "speschka@yammo.onmicrosoft.com");
go.Activity.Message = "This is the discussion page for the " + eventName + " event on " + eventDate;
go.Activity.Users.Add(new YammerActor("Anne Wallace", "annew@yammo.onmicrosoft.com"));
go.Activity.Users.Add(new YammerActor("Garth Fort", "garthf@yammo.onmicrosoft.com"));
YammerGraphObjectInstance jo = new YammerGraphObjectInstance();
jo.Url = Url;
jo.Title = eventName;
jo.Description = "This is the discussion page for the " + eventName + " event on " + eventDate;
jo.Image = "https://socialevents.azurewebsites.net/images/eventplanning.png";
jo.Type = "document";
go.Activity.Object = jo;
string postData = go.ToString();
string response = MakePostRequest(postData, graphPostUrl, yammerAccessToken, "application/json");
//serialize the results into an object with the OG ID
if (!string.IsNullOrEmpty(response))
{
gi = JsonConvert.DeserializeObject<YammerGraphObjectItem>(response);
string newMsg = "Welcome to the Yammer discussion for the " + eventName +
" event, happening on " + eventDate + ". We'll also be tracking external " +
"discussions about this event on Twitter by using the tags " + twitterTags + ".";
CreateOpenGraphPost(gi.object_id, newMsg);
}
One quick note about the code above. You may notice that I made the OG object Type a “document”. You can find the complete list of Types that are supported at http://developer.yammer.com/opengraph/#og-schema. There isn’t a type for “web site” so I just used document, but you can obviously choose one that works for you. Finally, assuming our OG was created successfully then we serialize the return JSON to get the YammerGraphObjectItem so we have the object_id we need to update it later on. Then we create the first discussion post to the OG item in the CreateOpenGraphPost method. It is extraordinarily simple, just the way I like it:
string msg = "body=" + Message + "&attached_objects[]=open_graph_object:" +
ID + "&skip_body_notifications=true";
//try adding the message
string response = MakePostRequest(msg, messageUrl + ".json", yammerAccessToken);
That’s it! We’ve talked about the semantics of working with Yammer Open Graph items, and we’ve looked at the specific implementation we used in the CloudTopia application. In the next post in this series we’ll look at adding a Web API component to your standard out of the box SharePoint App project. This can be extremely simple, I regularly use them in my SharePoint Apps now so I hope you’ll tune in and read more about it.
Tao http://dichvuketoanlongbien.com/
Rủa
http://dichvuketoanlongbien.com/a2-96-dich-vu-ke-toan-tron-goi.html
Thằng http://dichvuketoanlongbien.com/a2-98-dich-vu-ke-toan-thue.html
Cờ
http://dichvuketoanlongbien.com/a2-103-dich-vu-bao-cao-tai-chinh.html
Hó http://dichvuketoanlongbien.com/a2-97-dich-vu-quyet-toan-thue.html
Nào
http://dichvuketoanlongbien.com/a2-114-dich-vu-ke-toan-tai-29-quan-huyen.html
Soi
http://dichvuketoanlongbien.com/i780-dich-vu-ke-toan-thue-tron-goi-tai-bac-ninh.html
Tài
http://dichvuketoanlongbien.com/i779-dich-vu-ke-toan-thue-tron-goi-tai-bac-giang.html
Khoản
http://dichvuketoanlongbien.com/i778-dich-vu-ke-toan-thue-tron-goi-tai-phu-tho.html
Và
http://dichvuketoanlongbien.com/i781-dich-vu-ke-toan-thue-tron-goi-tai-hung-yen.html
Link
http://dichvuketoanlongbien.com/i782-dich-vu-ke-toan-thue-tron-goi-tai-vinh-phuc.html
Của
http://dichvuketoanlongbien.com/i783-dich-vu-ke-toan-thue-tron-goi-tai-hai-phong.html
Tao. http://www.trungtamketoan.com.vn/
Chúng
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-ha-noi.html
Mày
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-tp-hcm.html
Đủ
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-quang-ninh.html
Trình
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-hai-duong.html
Thì
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-bac-giang.html
Tự
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-bac-ninh.html
Đi
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-hai-phong.html
Mà
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-nam-dinh.html
Làm.
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-thai-binh.html
Việc
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-thanh-hoa.html
Gì
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-vinh-phuc.html
Phải
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-hung-yen.html
Rẻ
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-phu-tho.html
Rách
http://www.trungtamketoan.com.vn/p/trung-tam-dao-tao-ke-toan-tai-binh-duong.html
Như http://www.tosvn.com
Thế. http://iketoan247.blogspot.com
Loại http://tailieuveketoan.blogspot.com
Chó http://mauhinhnendep.blogspot.com
Má. http://www.tosvn.com/search/label/Hack%20CF
Tao http://www.tosvn.com/search/label/Hack%20AvatarStar
Rủa http://www.tosvn.com/search/label/Hack%20Warcraft-Dota2
Những http://hocketoan360.com/category/tai-lieu-ke-toan/
Thằng http://iketoan247.blogspot.com/search/label/thong-tin-kinh-te
Soi http://iketoan247.blogspot.com/search/label/tin-bai-ve-thue
Tao http://hoclamketoan.edu.vn/
Sẽ http://hoclamketoan.edu.vn/category/khoa-hoc-ke-toan
Tan http://hoclamketoan.edu.vn/category/dich-vu-ke-toan
Cửa http://hoclamketoan.edu.vn/category/hoc-lam-ke-toan
Nát http://hoclamketoan.edu.vn/category/tai-lieu-ke-toan
Nhà http://hocketoan360.com/
Haha http://hocketoan360.com/category/khoa-hoc-ke-toan/
http://hocketoan360.com/category/dich-vu-ke-toan/
In Part 2 of this series we looked at some of the details of working with Yammer Open Graph items in
In Part 3 of this series we looked at the plumbing required to add support for Web API 2.x to your SharePoint
In Part 4 of this series we looked at the integration with various Azure services in the CloudTopia app
In Part 5 of this series we looked at all of the different ways in which CloudTopia is integrated with
This is going to be a multi-part series to dissect and tear apart an application I tweeted about using
m88 : http://m88en.com
M88.com offer online sports games Asia, Sports Betting Asia, Sports Betting Sites Asia.
m88asia : http://m88en.net
Link to M88BET phone: m88en.com. – Register and Open Betting Account and Membership M88BET.
m88bet : http://www.linkm88vip.com
MANSION88 the house is one of the largest and most prestigious. Appeared quite early in the Asian market, the so-MANSION88 currently attracts more players.
link m88 : http://m88wiki.com
Home the M88 is the official sponsor of the football club in the Premier League
Wish you happy with the new M88
m88 casino online : http://m88free.com