I am using Microsoft Graph SDK for C#. Link is as follows ("https://github.com/microsoftgraph/msgraph-sdk-dotnet").
The query I am using to get all the items from the SharePoint site is as follows.
// Get Graph API Token
GraphServiceClient client = await MicrosoftGraphClient.GetGraphServiceClient();
// Fetch all DriveItems from Sharepoint Site
var results = await client.Sites[sharePointId].Drive.Root.ItemWithPath("SalesPortal/Presentations/" + orgnaization).Children.Request(queryOptions).GetAsync();
This query is working perfectly fine but it is fetching only the first 200 records. I need all the records present in that path.
Thanks in advance.
Per the docs: https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/collections.md#getting-a-collection
The results object you have should have a NextPageRequest property if there are more results to fetch.
Keep making the NextPageRequest, aggregating your results as your go, until it comes back null.
Related
I used the previous beta Bookings API for getting appointments in a timeframe, the previous structure of bookingappointment just worked there.
Right now I try to update the client to use the production ready v1 API, and all appointments returned by calenderview not containing Customer data.
I'm pretty sure those appointments should have customers, there are sent invitation emails to customers regarding the appointment.
The /customers endpoint shows all customers.
The issue reproducable by C# SDK and Graph Explorer as well.
GraphExplorer
There is a workaround, or what am I missing here?
Looks like a bug in Graph API.
According to the documentation the customers property is optional. Sometimes you have to specify optional property in $select statement.
You can try to add Select() to calendar view request and check whether it will work.
var queryOptions = new List<QueryOption>()
{
new QueryOption("start", "2022-01-30T00:00:00Z"),
new QueryOption("end", "2022-01-31T00:00:00Z")
};
var calendarView = await graphClient.Solutions.BookingBusinesses["{id}"].CalendarView
.Request(queryOptions)
.Select("customers") // select customers
.GetAsync();
This a known Graph API bug, until it is resolved,
I using listview to find all appointments, and getting appointments one by one using the /appointments/AAMkADQ0YTdhYWQAAA= endpoint using the Ids from listview.
Example:
GET https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/Contosolunchdelivery#contoso.onmicrosoft.com/appointments/AAMkADKnAAA=
This way the customer field always shows up, if there are regarding customers for a given appointment.
Source
In microsoft teams, there is a tab titled "Organization", which shows something like this:
Is there any way I can get this data in C# by using Graph API?
Right now I have
var users = await graphClient.Users.Request().GetAsync();
which returns an array of all users, and each user has their name and job title. This is not enough to make the org chart, because it does not tell how different users relate. What Graph API call do I need to make in order to get the data to make the org chart?
If you are using Microsoft Graph SDK for C#, you can use the code below to get users with the manager:
var usersWithMgr = await graphServiceClient.Users.Request().Expand("manager").GetAsync();
Result:
I found out you can make a graph call to users to get all users in a domain, then foreach user, make a call as listed here: https://learn.microsoft.com/en-us/graph/api/user-list-manager?view=graph-rest-1.0&tabs=csharp
This will get the manager, which can be manipulated into a hierarchical view.
UPDATE:
var users = await graphClient.Users.Request().Expand("manager")
.Select(u => new { u.DisplayName, u.JobTitle, u.AccountEnabled}).GetAsync();
I am using Elizabeth's wrapper from https://github.com/mozts2005/ZendeskApi_v2
I want to pull a list of agents. I don't see any built in Function that will allow that.
I have tried using the endpoint of /api/v2/users.json?role=agent with the GetAllUsers() function but it still returns all of them.
Right now, I am going to add a custom field to be able to search for them, but that should not be the case, especially since Zendesk's API does have an option for returning users based on their role: /api/v2/users.json?role[]=admin&role[]=end-user
Can anyone help me out?
You can give a try to the Zendesk Search API:
from urllib.parse import urlencode
import requests
results = [] # Empty list to collect pagination results
credentials = 'your_zendesk_email', 'your_zendesk_password'
session = requests.Session()
session.auth = credentials
params = {
'query': 'type:user role:agent'
}
url = 'https://your_subdomain.zendesk.com/api/v2/search.json?' + urlencode(params)
while url:
response = session.get(url)
data = response.json()
results += data['results']
url = data['next_page'] # should return false according to the doc when the last page is reached
Useful resources:
zendesk api python tutorial
zendesk api pagination
Search endpoint seems to be supported also in the c# library you are using.
I am developing a server application that should be able to react to the amount of likes for some of the posts in the user's feed.
I need to get post from users wall.
I'm using Facebook library version 6.4.2
I use the following code to get the posts:
var apiKey = ConfigurationManager.AppSettings["apiKey"];
var secret = ConfigurationManager.AppSettings["secret"];
var client = PostHandler.CreateFacebookClient(apiKey, secret);
var get = client.Get(string.Format("/{0}/feed", pageId));
and/or (both return the same info)
var token =ConfigurationManager.AppSettings["token"];
var get = client.Get(string.Format("/{0}/feed?access_token={1}", pageId, token));
The problem is that using the same set of permissions the json returned from the request above is different from the json returned from json returned from Graph API Explorer methog GET 100000481752436/feed
In my opinion the json returned from my request is missing some posts and the one from the Geaph API all contains the posts from my feed.
Could you please advice, what could I have missed ?
If you are missing some posts in the feed it is most likely that you'll have to check the permissions set again.
Based on the type of posts you are missing you maybe have to add the user_status, user_activities, user_friends, user_checkins or user_games_activity permissions. Please make sure that you're using the correct set of the permissions for your particular task.
If you'll specify the type of the posts you are missing you may get much more helpful answers.
I am trying to access data remotely from sharepoint 2010 site using client object model. For some restrictions I am not able to use CAML query even if I use I am not able to filter for proper audiences based on user login (if you can help me regarding the CAML query is also fine :: i do not know how to get current user audience name and all audiences using CAML/client object model. This code sits on the mobile site and calling the share point site as shown in my code). This following code works good but not able to get the content from the webpart. Can someone help regarding this.
using (ClientContext ctx = new ClientContext("https://mysite.com/Pages/Default.aspx"))
{
ctx.ExecutingWebRequest += new EventHandler<WebRequestEventArgs> (clientContext_ExecutingWebRequest);
File home=ctx.Web.GetFileByServerRelativeUrl("/Student/Pages/default.aspx");
//get the web part manager
Microsoft.SharePoint.Client.WebParts.LimitedWebPartManager wpm = home.GetLimitedWebPartManager(Microsoft.SharePoint.Client.WebParts.PersonalizationScope.Shared);
IEnumerable<Microsoft.SharePoint.Client.WebParts.WebPartDefinition> wpds = null;
//create the LINQ query to get the web parts from
//the web part definition collection
wpds = ctx.LoadQuery(wpm.WebParts.Include(wp => wp.Id,wp => wp.WebPart));
//load the list of web parts
ctx.ExecuteQuery();
//enumerate the results
foreach (Microsoft.SharePoint.Client.WebParts.WebPartDefinition wpd in wpds)
{
string title= wpd.WebPart.Title;
Microsoft.SharePoint.Client.WebParts.WebPart wpart = wpd.WebPart;
????? How to render and receive the data (looking for the same data When you browse the site with the browser)
}
Code continues...
I am also struggling with this issue. It really looks like this is not possible with client object model. Actually i've asked it to some SharePoint staff member at Build Conference 2012.
But, with the SharePoint Designer it's actually possible to download the wanted WebPart. Fiddler may come handy to track down which service will deliver you the bits.
Take a look at this post here on SharePoint StackExchange
Unfortunately the post will not give you any concrete way to solve it.
Wish you good luck!