HI all I am trying to build a Node.js script that takes a GitHub Personal Access Token (PAT) via environment variable and fetches the sponsor subscriptions (i.e. who and what they are sponsoring) for the access token owner. I am fine with either using the GraphQL or REST API.
Is it even possible to get info of the PAT without providing a username?
Basically I am struggling to figure out how to implement the following: given a PAT get the owner information.
Thank you in advance for your help!
I figured it out! I was looking for viewer. Here is a sample query:
viewer {
login
name
}
Related
Unable to use Microsoft Graph API to create or update SharePoint list items with client credentials access token (getting access token with out a user), I get the following error,
I'm able to successfully call GET and DELETE methods with the same access tokens for the same site/list, additionally I'm able to call all methods GET/POST/PATCH/DELETE for the same site/list using the user generated access token.
For my use case I need to able to create/update list items with out user access so, followed this article - https://learn.microsoft.com/en-us/graph/auth-v2-service, API has required permissions granted in the application
can't seem to find any documentation on what exactly I'm missing, looks like POST/PATCH endpoints are looking for some user info in the token, but client crendentials do not have any user info so not sure what to do next, Here's the documentation I'm following https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http & I've tried using the .net graph client SDK as well and I get the same error message for both POST/PATCH requests.
Any help on how to successfully create/update sharepoint list items via graph api using client credential token would be highly appreciated.
Followed this article in setting up the application in azure ad - https://learn.microsoft.com/en-us/graph/auth-v2-service, Added app roles are as highlited in this article https://learn.microsoft.com/en-us/answers/questions/756563/app-roles-in-client-credentials-scope-in-azure-b2c.html but no luck.
Hope you are not using delegated permission in your personal account ,
Looks like there is something wrong with your API call ,make sure you are using the correct API call - https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
You can also Try to create and Update in graph explorer- https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http#example .
Hope this helps
Thanks
i try to get list of all users from Azure Devops with postman,
i tried this link : https://titi.net/{organization}/_apis/graph/users/{userDescriptor}?api-version=6.0-preview.1&userDescriptor=username&organization=titiproject
Please check if my finding helps ,
To get users using user descriptor we can use the below given API:-
e.g:-
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users/{userDescriptor}?api-version=6.0-preview.1
For more information please refer this MICROSOFT DOCUMENTATION|Get a user by its descriptor & Use Postman with the Microsoft Graph API
I'm working on accessing document libraries for Sharepoint sites via Mircosoft Graph, but haven't had any luck so far.
Here is my setup:
I have two sites
https://mydomain.sharepoint.com
https://mydomain.sharepoint.com/teams/MyTestSite
When I make an api call to https://graph.microsoft.com/v1.0/drives, the response doesn't contain id of document library for second site (https://mydomain.sharepoint.com/teams/MyTestSite).
I have gone through documentation and haven't found anything on how to accomplish this. If anyone got any idea about this, please share.
Thanks.
I was able to figure out a solution for this. A sharepoint site is represented as a Group in Office 365. I found that out by doing some hit and trial.
So, after looking up their documentation for anything related to a Group, I got to this: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/group
And, by using the List groups endpoint I was finally able to get a list of all the Sharepoint sites which the authenticated user can access.
This API call requires Group.Read.All scope while requesting access token and only Admin users can authorize this scope. So, this will need a separate interface for Admin to list groups, potentially store the group-user mapping on my app for the user to be able to make api call (/groups/{group-id}/drive/items/{item-id}) related to the drive.
The V1.0 API has a way to list your doc lib as follows
GET https://graph.microsoft.com/v1.0/sites/mydomain.sharepoint.com:/Teams/MyTestSite:/drives
Hope this helps.
The beta API also exposes a Sharepoint endpoint.
You can also use the path if you already know your site structure:
GET https://graph.microsoft.com/beta/sharepoint:/sites
Is there a way I could find out that a user has a OneDrive Site(for an Office365 account)?
I'm getting user list for my sharepoint site through
https://{domain}-my.sharepoint.com/_api/web/siteusers
but there is no field that could indicate if a user has an active OneDrive .By OneDrive I mean a personal site of this sort;
https://{domain}-my.sharepoint.com/personal/user_name_domain_microsoft_com
One way to find out is by accessing this URL for that user and check if it yields a 404 response.
I'm trying to get it done via the REST API? Any help on this?
The following User properties could be used to distinguish actual (or active) SPO users:
Principal.PrincipalType property - PrincipalType.User
value specifies a user as the principal type
UserIdInfo.NameIdIssuer property - configuration-agnostic
reference to the type of the name identifier issuer, for SPO users its value: urn:federation:microsoftonline
REST request:
/_api/web/siteusers?$filter=PrincipalType eq 1 and UserId/NameIdIssuer eq 'urn:federation:microsoftonline'
You can't do this right now using the O365 Files REST API, but you can using Powershell cmdlets (e.g. this page http://blog.blksthl.com/2014/08/07/office-365-guide-series-provision-onedrive-for-business-using-powershell/ shows you how to use Powershell to provision OneDrive for Business for a list of users, from there it's just a slight modification to print out if these folks have OneDrive provisioned)
But another workaround, which you alluded to, is to use the O365 Files REST API and make a call to this endpoint:
https://your_SP_URL.com/_api/v1.0/me/drive
If you get an error, you'll know the Drive hasn't been provisioned yet. It's an ugly solution, but it should work just fine for your purpose.
I want to get access token foursquare like this link `https://developer.foursquare.com/overview/auth#userless' and this is code
https://foursquare.com/oauth2/access_token
?client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&grant_type=authorization_code
&redirect_uri=YOUR_REGISTERED_REDIRECT_URI
&code=CODE
I don't understand what YOUR_CLIENT_ID,YOUR_CLIENT_SECRET and YOUR_REGISTERED_REDIRECT_URI are. Can you explain and show some examples ? Thank you very much for helping.
"Before you get started, you should create an app on Foursquare. This will give you a client ID and client secret which are needed for using the API. The documentation in this guide is meant to give a high-level conceptual overview of the Foursquare platform, help you grok its different parts and capabilities, and get started using the API’s most popular features."
https://developer.foursquare.com/start
Go to the link: https://foursquare.com/developers/apps
Click the option: "Create a new app". Enter the name of the app and a valid url from where your app can be downloaded. These two fields are mandatory. You can provide the details for other fields also. If you don't have a download link, you can create a folder in dropbox (google drive, onedrive) and provide that link. Create your app and you will get your private CLIENT_ID and CLIENT_SECRET.