Encountering ErrorIntenarlServerError when creating an event using Graph API - microsoft-graph-api

I Was able to create an event on a not delegated calendar but failed on the delegated calendar when using this endpoint:
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
I also tried to put a wrong access token and calendarId on the request just to make sure if I can encounter the same error message but It didn't trigger the issue.
This is the object we're passing.
CalendarRequest
{
start = new MicrosoftDateTimeZoneRequest() {
dateTime = dateTimeOffset.ToString(dateTimeFormat),
timeZone = "Pacific Standard Time"
},
end = new MicrosoftDateTimeZoneRequest() {
dateTime = dateTimeOffsetEnd.ToString(dateTimeFormat),
timeZone = "Pacific Standard Time"
},
subject = $"{activity.CustomerName} {activity.ActivityName} {activity.ActivityType}".Trim(),
body = new MicrosoftItemBodyRequest() { content = activity.Details + (activity.CustomerId > 0 ? ("|" + clientURL) : ""), contentType = "HTML" },
location = new MicrosoftLocationRequest() {
displayName = "Home"
},
attendees = new List<MicrosofAttendeeRequest>() {
new MicrosofAttendeeRequest() {
emailAddress = new MicrosoftEmailAddressRequest(){address = "karlo#tapnztest.onmicrosoft.com", name = "X TAP" },
type = "resource"
}
},
allowNewTimeProposals = false,
isOrganizer = true
}
And this is how I call the endpoint
var calendarResponse = GetCalendarEvent(accessToken);
var calendarID = calendarResponse.value.Where(a => a.owner.address == "test#tapteam.co.nz").FirstOrDefault()?.id;
var addCalendarEventRequest = new RestClient($"https://graph.microsoft.com/v1.0/me/calendars/{calendarID}/events");
var request = new RestRequest();
request.AddHeader("Authorization", "Bearer " + accessToken);
request.AddJsonBody(calendarRequest);
var response = addCalendarEventRequest.ExecuteAsync(request, Method.POST);
Payload
{
"subject": "CC - 1st Meeting Confirmed CC - 1st Meeting Confirmed",
"body": {
"content": "test",
"contentType": "HTML"
},
"start": {
"dateTime": "2021-02-25T15:30:00.000+13:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2021-02-25T16:00:00.000+13:00",
"timeZone": "Pacific Standard Time"
},
"location": {
"address": null,
"coordinates": null,
"displayName": "Home",
"locationEmailAddress": null,
"locationUri": null,
"locationType": null
},
"attendees": [
{
"emailAddress": {
"address": "karlo#tapnztest.onmicrosoft.com",
"name": "Karlo TAP"
},
"proposedNewTime": null,
"status": null,
"type": "resource"
}
],
"allowNewTimeProposals": false,
"transactionId": null,
"isOrganizer": true
}

Related

Adding Calendar Event using Microsoft Graph API

I am trying to create an event in a calendar from a Powershell script. It needs to add the calendar event to the organizer's calendar and then to a list of attendees. Below is what I am sending in the body of the request.
{
"subject": "Let's go for lunch",
"IsOrganizer": "true",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": "2020-08-31T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2020-08-31T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"attendee1#attendeeadress.com",
"name": "Attendee1"
},
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
}
},
{
"emailAddress": {
"address":"attendee2#attendeeadress.com",
"name": "Attendee2"
},
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
}
}
],
"organizer":{
"emailAddress":{
"name":"Specific Calendar",
"address":"calendarname#organizerorganization.onmicrosoft.com"
}
},
"allowNewTimeProposals": true
}
It appears successfully on the calendar of the attendees but not on the main organizer's calendar. Can anyone tell me what I am doing wrong and how I can get this to appear on the main organizer's calendar?
Thanks!
UPDATE - This is how I am getting the user token.
$Body = #{
'client_id' = 'my_client_id'
'scope' = 'https://graph.microsoft.com/.default'
'client_secret' = 'my_client_secret'
'grant_type' = 'password'
'userName' = 'calendarname#organizerorganization.onmicrosoft.com'
'password' = 'password'
}
It is now my understanding that this user should be set as the organizer of an event by default.
You can create an event using ROPC flow which gives you the user access token and using it you can call the /events endpoint with your payload as shown below.
POST https://graph.microsoft.com/v1.0/me/calendar/events
If you create an event with this token and give username as calendarname#organization.onmicrosoft.com this will be the organizer of the event.
And you can update 'subject', 'body/content' but you cannot update the event's 'start' and 'end' properties which is already a finished event.

Group a list of json object by property inside the common array using iOS Swift

I would like to ask if how to group the object by another object inside its common array based on the id in Swift.
Here's the JSON response, I need to group the list of the item by program id.
{
"id": "",
"ordered_by": 64,
"order_details": [
{
"resource": "Product",
"required_prescription": false,
"item": {
"id": 6,
"name": "Synergistic Copper Gloves",
"code": "51537661-C",
"enabled": true,
"generic_name": "Mediocre Steel Wallet",
"price_cents": 200000
},
"program": {
"id": 12, <----PROGRAM ID
"name": "Synergistic Wooden Shoes",
"provider": "Synergistic Rubber Coat",
"discount_type": "fixed"
}
},
{
"resource": "Product",
"required_prescription": true,
"item": {
"id": 7,
"name": "Rustic Leather Table",
"code": "74283131-P",
"enabled": true,
"generic_name": "Incredible Bronze Clock",
"price_cents": 8994
},
"program": {
"id": 12, <----PROGRAM ID
"name": "Synergistic Wooden Shoes",
"provider": "Synergistic Rubber Coat",
"discount_type": "fixed"
}
},
{
"resource": "Product",
"required_prescription": false,
"item": {
"id": 116,
"name": "Ergonomic Marble Hat",
"code": "98845056-A",
"enabled": true,
"generic_name": "Incredible Granite Lamp",
"price_cents": 8267
},
"program": {
"id": 10, <----PROGRAM ID
"name": "Durable Rubber Bag",
"provider": "Aerodynamic Steel Chair",
"discount_type": "fixed"
}
}
]}
For example, the item with program id 12 should be inserted under its common program.
This should be the expected object after grouping. The item was grouped by program id 12 & 10.
[
{
"id": 12, <----- PROGRAM ID
"name": "Synergistic Wooden Shoes",
"provider": "Synergistic Rubber Coat",
"discount_type": "fixed",
"item": [
{
"id": 6,
"name": "Synergistic Copper Gloves",
"code": "51537661-C",
"enabled": true,
"generic_name": "Mediocre Steel Wallet",
"price_cents": 200000
},
{
"id": 7,
"name": "Rustic Leather Table",
"code": "74283131-P",
"enabled": true,
"generic_name": "Incredible Bronze Clock",
"price_cents": 8994
}
]
},
{
"id": 10, <----PROGRAM ID
"name": "Durable Rubber Bag",
"provider": "Aerodynamic Steel Chair",
"discount_type": "fixed",
"item": [
{
"id": 116,
"name": "Ergonomic Marble Hat",
"code": "98845056-A",
"enabled": true,
"generic_name": "Incredible Granite Lamp",
"price_cents": 8267
}
]
}
]
I've successfully made it in Java using the sample code below:
private String parseJson(String source) {
JSONArray result = new JSONArray();
List<Integer> ids = new ArrayList<>();
HashMap<Integer,JSONObject> programs = new HashMap<>();
try {
JSONObject jSource = new JSONObject(source);
JSONArray orderDetails = jSource.getJSONArray("order_details");
if (orderDetails.length() > 0) {
for (int i = 0; i < orderDetails.length(); i++) {
JSONObject jsonObject = orderDetails.getJSONObject(i);
JSONObject item = jsonObject.getJSONObject("item");
JSONObject program = jsonObject.getJSONObject("program");
int programId = jsonObject.getJSONObject("program").getInt("id");
if (!ids.contains(programId)) {
ids.add(programId);
program.put("item",new JSONArray().put(item));
programs.put(programId,program);
}else{
program.put("item",programs.get(programId).getJSONArray("item").put(item));
}
}
for(int k :programs.keySet()){
result.put(programs.get(k));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
I'm trying to replicate it on swift but I'm looking for a different approach, not the same approach as I did in Java. I tried to used reduce and filter method but it doesn't work.
Any answer would be hight appreciated.
Thanks
Few comments on an answer from #omerfarukozturk,
Flatmap is deprecated so you can use map or compactMap.
In omerfarukozturk's answer he returns only program id while grouping which is not as per requirement, we need whole program details instead of just Id
So I have applied some other logic.
Bind data with model
let arrDetails = //Bind data with model, response.orderDetails
Get Unique program ID
let arrProgramID = arrDetails.compactMap{ $0.program }.removingDuplicates(byKey: \.id)
// removingDuplicates is logic for remove duplicate programs and have unique program array with all information
Bind array in [[Program: [Item]]] form
let finalArray = arrProgram.map { (program) -> [Program: [Item]] in
let arr = arrDetails.filter{ $0.program.id == program.id }.compactMap{ $0.item }
return [program: arr]
}
Adding extension for removing duplicates
extension Array {
func removingDuplicates<T: Equatable>(byKey key: KeyPath<Element, T>) -> [Element] {
var result = [Element]()
var seen = [T]()
for value in self {
let key = value[keyPath: key]
if !seen.contains(key) {
seen.append(key)
result.append(value)
}
}
return result
}
}
You can use Dictionary(grouping:) to group a list. Not completely answer, but for your case you can create a logic like below;
Assume you have a decoded response model as response for your json.
let flatttenOrderDetails = response.order_details.flatMap( { $0 })
let grouped = Dictionary(grouping: flatttenOrderDetails, by: { (element: Detail) in
return element.program.id
})
I was able to group the JSON based on its common program id by creating another model ProgramWith items.
struct ProgramWithItems: Codable {
let id: Int?
let name: String?
let provider: String?
let discountType: String?
let resource: String?
let discount: String?
let item: [Item]
}
Then I used the reduce method and populate the ProgramWithItems model using the code below:
func groupItems(_ response: CartEntity.Response) -> [ProgramWithItems] {
response.orderDetails!.reduce(into: []) { (result: inout [ProgramWithItems], detail: OrderDetail) in
guard let index = result.firstIndex(where: { $0.id == detail.program?.id }) else {
var item = detail.item
item?.quantity = detail.quantity
item?.costCents = detail.cost_cents
let newProgram = ProgramWithItems(
id: detail.program?.id,
name: detail.program?.name ?? "",
provider: detail.program?.provider ?? "",
discountType: detail.program?.discountType ?? "",
resource: detail.resource ?? "",
discount: detail.program?.discount,
item: [item!])
result.append(newProgram)
return
}
let existingProgram = result[index]
var item = detail.item
item?.quantity = detail.quantity
item?.costCents = detail.cost_cents
let extendedProgram = ProgramWithItems(
id: existingProgram.id,
name: existingProgram.name,
provider: existingProgram.provider,
discountType: existingProgram.discountType,
resource: detail.resource ?? "",
discount: detail.program?.discount,
item: existingProgram.item + [item!])
result[index] = extendedProgram
}
}

Expanding singleValueExtendedProperty not working when retrieving Event details

I am trying to retrieve custom property value for an event using Microsoft Graph.
The custom property was created by an Outlook Office.js Add-ing
Here is request
/v1.0/me/events/{id}?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name myCusProp')
This returns a successful response from Graph but it does not return the singleValueExtendedProperty. The Outlook add-in, however, is still able to retrieve the property value from the same Event.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{id}')/events/$entity",
"#odata.etag": "W/\"SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==\"",
"id": "{id}",
"createdDateTime": "2019-09-30T10:12:34.110571Z",
"lastModifiedDateTime": "2019-09-30T10:23:57.8338159Z",
"changeKey": "SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==",
"categories": [],
"originalStartTimeZone": "blah blah",
"originalEndTimeZone": "blah blah Standard Time",
"iCalUId": "040000008...EBBE4999DC5A61D31AC544",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "WWW-002",
"bodyPreview": "rt",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AQMkADU2OWFjYTFjLWNkMGYtNDdlNS1hNDIxLWIxYjlmY...DqyJu%2FWyzJk6m5v0MbSs7lwcASdXmMkSN8kCNtzTsQ4x1lwAAAgENA...AD7q52owAAAA%3D%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"recurrence": null,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\n<div>rt</div>\r\n</body>\r\n</html>\r\n"
},
"start": {
"dateTime": "2019-09-19T02:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-09-19T03:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Info a",
"address": "name#domain.com"
}
}
}
----Update 1 - office.js code-----
This is office-js/outlook-add-in code reference above.
The custom property value can be read here without an issue.
const item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync(asyncResult => {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
let customProps = asyncResult.value;
customProps.set("myCusProp", "google.com");
customProps.saveAsync(asyncResult => {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
item.loadCustomPropertiesAsync(asyncResult => {
const customProps = asyncResult.value;
const myCusProp = customProps.get("myCusProp");
})
}
});
}
});
From documentation:
id eq 'String {00020329-0000-0000-C000-000000000046} Name cecp-<add-in id from manifest>'
Instead of myCusProp use cecp-/* add-in id from manifest */
Add-in id is the guid from manifest, this response has a custom properties as JSON.

TFS 2017 Work item Extension not working

New to this TS scripting so a little help is requested,
I'm trying to create an extension that created a url from 4 work item fields.
example contribution:
{
"manifestVersion": 1,
"id": "tritech-tfsurl-control",
"version": "0.1.18",
"name": "tritech-tfsurl-control",
"scopes": [ "vso.work", "vso.work_write" ],
"description": "4 fields to a url",
"publisher": "TriTech-Software-Systems",
"icons": {
"default": "img/logo.png"
},
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"tags": [
"Work Item",
"Work Item control",
"Url",
"Url tfs server"
],
"content": {
"details": {
"path": "details.md"
}
},
"links": {
"home": {
"uri": "http://www.Tritech.com"
}
},
"branding": {
"color": "rgb(220, 235, 252)",
"theme": "light"
},
"files": [
{
"path": "img",
"addressable": true
},
{
"path": "index.html",
"addressable": true
}
],
"categories": [
"Plan and track"
],
"contributions": [
{
"id": "tfsurlcontrol-action",
"type": "ms.vss-work-web.work-item-form-control",
"description": "Work Item fields to create url from",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "tfsurl-control",
"uri": "index.html",
"height": 90,
"inputs": [
{
"id": "PreviousTFSServer",
"description": "The TFS server url that has the work item.",
"type": "WorkItemField",
"properties": {
"workItemFieldTypes": [ "String" ]
},
"validation": {
"dataType": "String",
"isRequired": true
}
},
{
"id": "TFSCollection",
"description": "The original tfs collection name",
"type": "WorkItemField",
"properties": {
"workItemFieldTypes": [ "String" ]
},
"validation": {
"dataType": "String",
"isRequired": true
}
},
{
"id": "TfsTeamProject",
"description": "Original TFS project name",
"type": "WorkItemField",
"properties": {
"workItemFieldTypes": [ "String" ]
},
"validation": {
"dataType": "String",
"isRequired": true
}
},
{
"id": "TfsWorkItemId",
"description": "Original work item id",
"type": "WorkItemField" ,
"properties": {
"workItemFieldTypes": [ "Integer" ]
}
}
]
}
}
]
}
then in my App.ts file is this,
///<reference types="vss-web-extension-sdk" />
import { Controller } from "./control";
import * as ExtensionContracts from "TFS/WorkItemTracking/ExtensionContracts";
import { WorkItemFormService } from "TFS/WorkItemTracking/Services";
var control: Controller;
var provider = () => {
return {
onLoaded: (workItemLoadedArgs: ExtensionContracts.IWorkItemLoadedArgs) => {
control = new Controller();
}
}
};
VSS.register(VSS.getContribution().id, provider);
this is my Control.ts file,
`
private _initialize(): void {
this._inputs = VSS.getConfiguration().witInputs;
this._ServerFieldName = this._inputs["PreviousTFSServer"];
this._CollectionFieldName = this._inputs["TFSCollection"];
this._ProjectFieldName = this._inputs["TFSTeamProject"];
this._WorkItemIdFieldName = this._inputs["TfsWorkItemId"];
WitService.WorkItemFormService.getService().then(
(service) => {
Q.spread<any, any>(
[ service.getFieldValue(this._ServerFieldName),service.getFieldValue(this._CollectionFieldName),
service.getFieldValue(this._ProjectFieldName),service.getFieldValue(this._WorkItemIdFieldName)],
(server: string, collection: string, project:string, id: number) => {
this._view = new View(server,collection,project,id);
}, this._handleError
).then(null, this._handleError);
},
this._handleError);
}
private _handleError(error: string): void {
let errorView = new ErrorView(error);
}
}
`
Then I added a view.ts
export class View {
constructor(server: string, collection: string, project: string, id: number) {
// container div
if(server)
{
var Container = $("<div />");
var workItemUrl = $("<span></span>").text("Original work item");
var a = $("<a> </a>");
var url = 'server + "/" + collection + "/" + project + "/_workitemId?=" + String(id)'
a.attr("href", url );
a.attr("target", "_blank");
a.text("here.");
workItemUrl.append(a);
//$('body').empty().append(Container);
$(".events").append(workItemUrl);
}
}
}
<Input Id="PreviousTFSServer" Value="TriTech.Source.Server" />
<Input Id="TFSCollection" Value="TriTech.Source.Collection" />
<Input Id="TFSTeamProject" Value="TriTech.Source.Project" />
<Input Id="TfsWorkItemId" Value="TriTech.Source.Id" />
</Inputs>
</ControlContribution>
</Group>`
I started with the latest edition of the vsts-extension-ts-seed-simple-master package. Compiles and creates the extension but I'm not seeing any url or link.
What am I missing?
The WIT has been edited to use the extension.
Web debug shows it is being loaded,
{"id":"TriTech-Software-Systems.tritech-tfsurl-control.tritech-tfsurlcontrol-action","description":"Work Item fields to create url from","type":"ms.vss-work-web.work-item-form-control-group","targets":["ms.vss-work-web.work-item-form"],"properties":{"name":"tritech-tfsurl-control","uri":"index.html","height":90,"inputs":[{"id":"PreviousTFSServer","description":"The TFS server url that has the work item.","type":"WorkItemField","properties":{"workItemFieldTypes":["String"]},"validation":{"dataType":"String","isRequired":true}},{"id":"TFSCollection","description":"The original tfs collection name","type":"WorkItemField","properties":{"workItemFieldTypes":["String"]},"validation":{"dataType":"String","isRequired":true}},{"id":"TfsTeamProject","description":"Original TFS project name","type":"WorkItemField","properties":{"workItemFieldTypes":["String"]},"validation":{"dataType":"String","isRequired":true}},{"id":"TfsWorkItemId","description":"Original work item id","type":"WorkItemField","properties":{"workItemFieldTypes":["Integer"]}}],"::Attributes":16,"::Version":"0.1.20"}}
Thanks in advance.
I ended up using static values and got it working.
var Provider = () => {
this.ServerfieldName = "Source.Server";
this.CollectionfieldName = "Source.Collection";
this.ProjectfieldName = "Source.Project";
this.WorkItemIdfieldName = "Source.Id";
this._view = View;
return{
onLoaded: (WorkItemLoadedArgs: ExtensionContracts.IWorkItemLoadedArgs) => {
var deferred = Q.defer();
WorkItemFormService.getService().then(
(service) => {
Q.spread<any, any>(
[service.getFieldValue(this.ServerfieldName),service.getFieldValue(this.CollectionfieldName),
service.getFieldValue(this.ProjectfieldName),service.getFieldValue(this.WorkItemIdfieldName)],
(server: string, collection: string, project: string, workitemId: number) => {
var data =(`${server}/${collection}/${project}/_workitems#_a=edit&id=${workitemId}`);
if(server){
this._view = new View(data);
}
else{
$('body').empty().append("This is the original Work Item");
}
})
.catch(function (e) {deferred.reject(e)}
);
return deferred.promise; //.then(null);
}
)}
}
};
and used a view,
/// <reference path="../typings/index.d.ts" />
export class View {
constructor(public value:string) {
var Container = $("<div role='link'> </div>");
Container.addClass("Container");
Container.attr('tabindex', '0');
var rdiv = $("<div/>").addClass("rightDiv");
var ldiv = $("<div/>");
var help = $("<span></span>").text("Original Tfs work item ");
var a = $("<a> </a>");
a.attr("href", value);
a.attr("target", "_blank");
a.text("here.");
help.append(a);
ldiv.append(help);
Container.append(rdiv);
Container.append(ldiv);
$('body').empty().append(Container);
}
}

facebook graph api for poste is not show all data in ios

i am working one facebook intrgation project in ios,iphone
so i am using me?fields=posts on browser is working properly
i means on this link developer account
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Dposts
but when i am using me?fields=posts in xcode this only return a old data not all data
here is my code so please give me solution where i am doing mistake
[FBRequestConnection startWithGraphPath:#"me?fields=posts"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(#"Results: %#", result);
NSArray *post = [result valueForKey:#"posts"];
NSArray *mainData = [post valueForKey:#"data"];
/// NSLog(#"Results: show image>>>>>>> %#", [mainData valueForKey:#"picture"]);
//
NSArray *picturedata =[mainData valueForKey:#"picture"];
NSLog(#"%#",picturedata);
Here i attacha a image link also please check
image 1
in Graph api data is
{
"posts": {
"data": [
{
"id": "100005440749818_240650716126285",
"from": {
"name": "Birjesh Sharma",
"id": "100005440749818"
},
"message": "Hello\r\n\r\n\r\n",
"picture": "https://fbexternal-a.akamaihd.net/app_full_proxy.php?app=278318608948142&v=1&size=z&cksum=9c977855a08e5bde268444a1ab24a254&src=https%3A%2F%2Fraw.github.com%2Ffbsamples%2Fios-3.x-howtos%2Fmaster%2FImages%2Fiossdk_logo.png",
"link": "https://developers.facebook.com/ios",
"name": "Facebook SDK for iOS",
"caption": "Build great social apps and get more installs.",
"description": "The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.",
"icon": "https://www.facebook.com/images/litestand/bookmarks/sidebar/icons/small/icon-app.png",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100005440749818/posts/240650716126285"
},
{
"name": "Like",
"link": "https://www.facebook.com/100005440749818/posts/240650716126285"
}
],
"privacy": {
"description": "Friends",
"value": "ALL_FRIENDS",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "app_created_story",
"application": {
"name": "Feed Dialog How To",
"id": "278318608948142"
},
"created_time": "2014-04-26T12:59:15+0000",
"updated_time": "2014-04-26T12:59:15+0000"
},
{
"id": "100005440749818_240650712792952",
"from": {
"name": "Birjesh Sharma",
"id": "100005440749818"
},
"message": "Hello\r\n\r\n\r\n",
"picture": "https://fbexternal-a.akamaihd.net/app_full_proxy.php?app=278318608948142&v=1&size=z&cksum=9c977855a08e5bde268444a1ab24a254&src=https%3A%2F%2Fraw.github.com%2Ffbsamples%2Fios-3.x-howtos%2Fmaster%2FImages%2Fiossdk_logo.png",
"link": "https://developers.facebook.com/ios",
"name": "Facebook SDK for iOS",
"caption": "Build great social apps and get more installs.",
"description": "The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.",
"icon": "https://www.facebook.com/images/litestand/bookmarks/sidebar/icons/small/icon-app.png",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100005440749818/posts/240650712792952"
},
{
"name": "Like",
"link": "https://www.facebook.com/100005440749818/posts/240650712792952"
}
],
"privacy": {
"description": "Friends",
"value": "ALL_FRIENDS",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "app_created_story",
"application": {
"name": "Feed Dialog How To",
"id": "278318608948142"
},
"created_time": "2014-04-26T12:59:14+0000",
"updated_time": "2014-04-26T12:59:14+0000"
},
{
"id": "100005440749818_240643612793662",
"from": {
"name": "Birjesh Sharma",
"id": "100005440749818"
},
"message": "Hello how are you",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100005440749818/posts/240643612793662"
},
{
"name": "Like",
"link": "https://www.facebook.com/100005440749818/posts/240643612793662"
}
],
"privacy": {
"description": "Friends",
"value": "ALL_FRIENDS",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "status",
"status_type": "mobile_status_update",
"application": {
"name": "Batch Requests How To",
"id": "216458921816803"
},
"created_time": "2014-04-26T12:20:43+0000",
"updated_time": "2014-04-26T12:20:43+0000"
},
{
"id": "100005440749818_240368252821198",
"from": {
"name": "Birjesh Sharma",
"id": "100005440749818"
},
"story": "Birjesh Sharma added a new photo.",
"picture": "https://fbcdn-photos-e-a.akamaihd.net/hphotos-ak-prn2/t1.0-0/10155869_240368246154532_637168545169195821_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=240368246154532&set=a.170520606472630.1073741830.100005440749818&type=1&relevant_count=1",
"name": "HelloFBSample Photos",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100005440749818/posts/240368252821198"
},
{
"name": "Like",
"link": "https://www.facebook.com/100005440749818/posts/240368252821198"
}
],
"privacy": {
"description": "Only Me",
"value": "SELF",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "240368246154532",
"application": {
"name": "HelloFBSample",
"namespace": "fbsdktemplateapp",
"id": "355198514515820"
},
"created_time": "2014-04-25T13:26:06+0000",
"updated_time": "2014-04-25T13:26:06+0000"
},
{
"id": "100005440749818_240333912824632",
"from": {
"name": "Birjesh Sharma",
"id": "100005440749818"
},
"message": "Post by nishant",
"picture": "https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn2/t1.0-0/10155899_240333846157972_3108893745639530212_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=240333846157972&set=a.239581289566561.1073741833.100005440749818&type=1&relevant_count=1",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100005440749818/posts/240333912824632"
},
{
"name": "Like",
"link": "https://www.facebook.com/100005440749818/posts/240333912824632"
}
],
"privacy": {
"description": "Public",
"value": "EVERYONE",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "240333846157972",
"created_time": "2014-04-25T10:33:45+0000",
"updated_time": "2014-04-25T10:33:45+0000",
"likes": {
"data": [
{
"id": "100005440749818",
"name": "Birjesh Sharma"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA1NDQwNzQ5ODE4",
"before": "MTAwMDA1NDQwNzQ5ODE4"
}
}
}
},
and when i am using this graph api in xcode the data show this
Results: {
id = 100005440749818;
posts = {
data = (
{
"created_time" = "2014-04-17T14:13:12+0000";
from = {
id = 100005440749818;
name = "Birjesh Sharma";
};
id = "100005440749818_238353183022705";
link = "https://www.facebook.com/nitin.dhiran.1?fref=nf_fr";
picture = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t1.0-1/c0.9.50.50/p50x50/10262125_697172320343788_6250762651875413687_t.jpg";
privacy = {
value = "";
};
"status_type" = "approved_friend";
story = "Birjesh Sharma is now friends with Nitin Dhiran and 3 other people.";
"story_tags" = {
0 = (
{
id = 100005440749818;
length = 14;
name = "Birjesh Sharma";
offset = 0;
type = user;
}
);
35 = (
{
id = 100001530793389;
length = 12;
name = "Nitin Dhiran";
offset = 35;
type = user;
}
);
52 = (
{
id = 100008058972523;
length = 14;
name = "Hemant Kumar";
offset = 52;
type = user;
},
{
id = 100001307401657;
length = 14;
name = "Chetan Pushpad";
offset = 52;
type = user;
},
{
id = 100002675972915;
length = 14;
name = "Vipin Shukla";
offset = 52;
type = user;
}
);
};
type = link;
"updated_time" = "2014-04-17T14:13:12+0000";
},
{
"created_time" = "2014-03-27T07:21:35+0000";
from = {
id = 100005440749818;
name = "Birjesh Sharma";
};
id = "100005440749818_232528183605205";
privacy = {
value = "";
};
"status_type" = "approved_friend";
story = "Birjesh Sharma is now friends with Ishant Tiwari and Viraj Dongre.";
"story_tags" = {
0 = (
{
id = 100005440749818;
length = 14;
name = "Birjesh Sharma";
offset = 0;
type = user;
}
);
35 = (
{
id = 100000329153640;
length = 13;
name = "Ishant Tiwari";
offset = 35;
type = user;
}
);
53 = (
{
id = 100002123975517;
length = 12;
name = "Viraj Dongre";
offset = 53;
type = user;
}
);
};
type = status;
"updated_time" = "2014-03-27T07:21:35+0000";
}
);
paging = {
next = "https://graph.facebook.com/100005440749818/posts?access_token=CAAUTJQ2n428BAN3p9kiFFMZA7ZBlDO2NTIddfkUNJdbqT32kfbVs8GJaORmJXTF4NnF6RUtIwwp0H0vTzS147lxFF3runTHbupqZBkxbyl73dV5URHwvZA78CqVXWJggaofAy2JfZBf1GCoUQfNCyN0TAJaEnnsLn9ea6d2wLtDAataFtxGyFQJwZBWajQOiIwtidXqliCFV8haorHgfE4ahdbpO5n7oUZD&limit=25&until=1395904894";
previous = "https://graph.facebook.com/100005440749818/posts?access_token=CAAUTJQ2n428BAN3p9kiFFMZA7ZBlDO2NTIddfkUNJdbqT32kfbVs8GJaORmJXTF4NnF6RUtIwwp0H0vTzS147lxFF3runTHbupqZBkxbyl73dV5URHwvZA78CqVXWJggaofAy2JfZBf1GCoUQfNCyN0TAJaEnnsLn9ea6d2wLtDAataFtxGyFQJwZBWajQOiIwtidXqliCFV8haorHgfE4ahdbpO5n7oUZD&limit=25&since=1397743992&__previous=1";
};
};
}
The posts list is divided into several pages, and you only got the first page. To get all the posts, use the URL in results.posts.paging.next.
You can use this FBSDKGraphRequest paging extension to do that for you.

Resources