checkin a one drive document using graph api - microsoft-graph-api

I am trying to checkout a drive item using microsoft graph API
as mentioned in https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_checkout#example
But when I am trying to use graph API explorer it gives me an error
Unsupported segment type. ODataQuery: sites/bluejdemo.sharepoint.com/drives/...

Check-in and check-out are only available in the /beta/ version of Microsoft Graph. I can see how the documentation doesn't make that clear, so sorry about that. I'll make sure we get those docs updated.
Here's call you need to make:
https://graph.microsoft.com/beta/sites/{insert your URL here}/checkout

Related

Getting file version from TFS rest API Get Item

I am pulling a file from on premise TFS source control using the Rest API. I can't find on premise specific documentation, but it seems to be very close to version 4.1 of the Azure Get Item call. According to this documentaiton, it should return a TfvcItem object which has a lot of metadata including the version. However, when I make the call it only returns the file contents (the content field of the documentation's TfvcItem).
How do I get the current version of the file?
I need the version when I check itin with create changeset. I don't need it for any other reason, so if you know another way to check in an edited file that would help.
Instead of using Get Item API, some related REST APIs are not documented. For these REST APIs we can use tools such as Fiddler or directly press F12 - network in Chrome to track them.
You should use below API to fetch latest changeset version of a file:
post https://dev.azure.com/{organizationname}/{Projectname}/_api/_versioncontrol/history?__v=5
For body:
{"repositoryId":"","searchCriteria":"{\"itemPath\":\"$/MyFirstProject/Main/1.txt\",\"itemVersion\":\"T\",\"top\":50}"}
itemPath is your server path of the file.
From the response, you will get the version info such as "version": "139", instead of the file content.
Not sure your detail version of TFS, I was using Azure DevOps Service for an example. There maybe some difference for different TFS version. You could track the detail API on your own side.
More detail info kindly take a look at this question: VSTS Release API Documentation
Had the same issue. You can get item metadata by specifying "scopePath" URI parameter, instead of "path". Microsoft example in API documentation seems incorrect, as it indeed returns only item content: https://learn.microsoft.com/en-us/rest/api/azure/devops/tfvc/items/get?view=azure-devops-rest-6.0#get-item-metadata-and/or-content-for-a-single-item.

how do you check out and check in ListItems?

I am having trouble locating the methods to "Check Out" (or otherwise lock) and "Check In" documents in a SharePoint Online library/list using the Graph SDK. I don't actually see the REST calls listed either, but I have to believe they are somewhere, because OneDrive for Business webclient exposes these functions.
Basically, in some version-control scenarios, SharePoint admins and/or designers can "Require Check Out" in the library's Versioning Settings configuration. Editing a document is then a multi-step process, one of the first steps is to "Check Out" the document from the library so it is locked for edits to the current user. I can not find this method (and the mirror method "Check In") in reviewing the REST docs or the Graph SDK source code on GitHub. These methods would be required if a library is configured to "Require Check Out".
I have looked through the (Graph)List and ListItem objects pretty thoroughly (including the Versions relationship/collection) and can not locate the methods. I would have expected them to be available on a ListItem object.
If anyone has any code to work with document ListItems in this manner - or simply knows where to find these methods, it would be very helpful.
Those operations are not supported per list items (and in fact never was in SharePoint APIs) but are supported for files in document libraries via DriveItem resource which:
represents a file, folder, or other item stored in a drive. All file
system objects in OneDrive and SharePoint are returned as driveItem
resources.
Documentation:
checkout operation
checkin operation
The following example demonstrates how to checkout a file in document library:
POST https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/checkout
and check-in it:
POST https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/checkin

"Notes" vs "OneNote" in Graph API Endpoint - which is correct?

Official documentation for retrieving OneNote documents under an Office 365 Group states to use the URi format:
https://graph.microsoft.com/{version}/groups/{id}/onenote/{notebooks | sections | sectionGroups | pages}
Constructing a GET request of the format:
https://graph.microsoft.com/beta/groups/{id}/onenote/notebooks
fails for me, with a 400 error. No detailed information on why it failed is returned. If I run the same query through Graph Explorer, I get Unsupported segment type. ODataQuery: groups/d11c2cd1-8b41-48ee-b512-93921e19f741/onenote/notebooks
However, the following URL does work:
https://graph.microsoft.com/beta/groups/{id}/notes/notebooks
Note the difference here, using "notes" instead of "onenote". This works from the command line for me (PowerShell) and using Graph Explorer. I can also substitute "notebooks" here, for "pages" or "sections" and again this works with PowerShell or Graph Explorer.
Now, Create Notebook suggests a post to https://graph.microsoft.com/beta/groups/{id}/onenote/notebooks, and whether I try this, or https://graph.microsoft.com/beta/groups/{id}/notes/notebooks it still fails either programatically or through Graph Explorer.
It looks as though there used to be some "notes" documentation at https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/notes.md but this doesn't exist.
I'm unclear why "onenote" fails for everything, and "notes" works for getting notebooks/pages/sections but not creating a notebook.
Thank you in advance.
We are preparing the service for an update and the documentation went live a day before the service update. Stay tuned for a blog post by 5/4/17 that outlines the details of all the updates for the OneNote API.

How to get all work items in TFS 2013 using REST API

I need to retrieve all work items in TFS 2015.2 using REST API
I have referred below link from Microsoft
https://www.visualstudio.com/en-us/docs/work/track/using-queries
Below is the similar url pattern I used,
http://fabrikam:8080/tfs/DefaultCollection/q.aspx?pname=FabrikamFiber&wiql=SELECT [System.ID], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject]='FabrikamFiber' AND [System.WorkItemType]='Bug'
However this url end-up with nothing but error
Error
Error
The page you are looking for is currently unavailable.
TF400914: The specified team, q.aspx, either does not exist or you do not have access to it.
Please be kind enough to show some light to overcome this issue.
Note TFS 2015 require that you encode the WIQL portion of the URL syntax. You can use any URL encoder tool to encode your URL.
TFS 2015 syntax
https://{ServerName}/{CollectionName}/{TeamProjectName}/_workitems?_a=query&wiql={Encoded WorkItemQueryLanguage]
For example, the following hyperlink lists the ID, title, and state of all bugs under the FabrikamFiber/Web area path hosted on the fabrikam server and it's encoded url.
http://fabrikam:8080/tfs/DefaultCollection/FabrikamFiber/_workitems?_a=query&wiql=SELECT%20%5BSystem.ID%5D%2C%20%5BSystem.Title%5D%2C%20%5BSystem.State%5D%20FROM%20WorkItems%20WHERE%20%5BSystem.TeamProject%5D%3D'FabrikamFiber'%20AND%20%5BSystem.WorkItemType%5D%3D'Bug'%20AND%20%5BSystem.AreaPath%5D%3D'FabrikamFiber%5CWeb'%20%20
According to your url, seems you are still using TFS 2013 syntax, if you need to retrieve all work items in TFS 2015.2. Please use TFS2015 syntax instead.
If you need to retrieve all work items in TFS2013. The easiest way to define a hyperlink is to create a query that matches what you want and then copy the URL for the query. Create the same query in web portal/team explorer to narrow down the issue to see if you are able to get all work items. And copy the url directly to double check your url format.

Asana API retrieve project owner, status and deadline

Is there a way using the Asana api to retrieve the project owner, project status, project description and project deadline?
I checked the API docs and could not find anything, so I am assuming the answer is no (but confirmation is much appreciated).
https://asana.com/developers/api-reference/projects#sections
If there is not a way of doing this via the API, does anyone have any hacks on how to do this using something like Selenium or another tool?
Much appreciated.
Project overview attributes are accessible attributes on project objects in the API.
current_status is the latest status update for the project including the color and text associated.
owner the current project owner.
due_date the current project due date.

Resources