How to Get Sharepoint data? - rest

I have just started a Sharepoint, I would need items listed in Sharepoint 2013.
Please let me know is any rest service available to access data from sharepoint which I can store in my local db.
Please suggest me what are the best way to access data from it.
Thanks,
Laxmilal Menaria

In SharePoint 2013 the REST API Endpoints are different.
It's more like this:
/_api/lists/getByTitle('Custom List')/Items

You can use the REST interface.
http://msdn.microsoft.com/en-in/library/ff798339.aspx
For example:
http://localhost/_vti_bin/listdata.svc/Parts(3)
The preceding URL returns the Parts list item with an ID value of 3 as an Atom feed.

Related

How to get version history of a file in folder in sharepoint using SharePoint REST API using c#?

I have a SharePoint library with a file in it. I need to get previous versions of the file who created it and when. What is the rest endpoint to fetch those details. I am new to SharePoint. Please help
You could use this rest endpoint to get previous versions of the file by the file id:
https://<server>/sites/<site>/_api/web/lists/getByTitle('Documents')/items(1)/versions
You could add filters at the end to get the information you need:
https://<server>/sites/<site>/_api/web/lists/getByTitle('Documents')/items(1)/versions?$select=VersionLabel,Created_x005f_x0020_x005f_By,Created
in order to get additional information from REST API request You need to use the $expand property. If You need information like who made the update please add '?$expand=CreatedBy' at the end of the request.. so for Your example it will be something like:
https:///sites//_api/web/GetFolderByServerRelativeUrl('Shared%20Documents/general')/files('SampleDocFile.docx')/versions?$expand=CreatedBy
that way You will have the user who modified the file in
content>properties>Title
other interesting data is:
updated>
content>properties>CheckInComment>
content>properties>VersionLabel>

MS VSTS Rest API's: Get List of Attachments for a given item

Using the Azure API's, I am able to get the content of an attachment using:
GET https://dev.azure.com/fabrikam/_apis/wit/attachments/{id}?api-version=4.1
This assumes you know the guid (id) of the attachment you wish to download.
What I am trying to do is for a given workItem ID, get a list of ALL attachments (including the ID). Anyone know what the easiest way to achieve this is?
I find this Azure API may be helpful for you.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&api-version=4.1
For more details, you can refer to this doc.
Try $expand=Relations in the Api-Url
E.g. GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&$expand=Relations&api-version=4.1

Microsoft Graph API - /drive/root/children always empty, even though I have files in my onedrive

I'm trying to use the Microsoft Graph API to List Children by Getting access without a user
I have built my URL as you would expect:
https://graph.microsoft.com/v1.0/edffcd1c-e5b2-42f2-b554-XXXXXXXXX/drive/root/children
Where edffcd1c-e5b2-42f2-b554-XXXXXXXXX is the user ID of whom I'm trying to list the files.
Yet when I call this I get an empty result every time:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drive/root/children",
"value": []
}
Why is that?
UPDATE: It seems that this API is only returning files from the Sharepoint account... not the OneDrive account. I already have access to the Sharepoint files from the Sharepoint API's themselves. Is there a way to get OneDrive files from the Microsoft Graph API?
This URL https://dev.onedrive.com/README.htm seems to state that we should be able to do this.
Is there a way to get OneDrive files from the Microsoft Graph API?
Yes, there is: you must use the scope Files.Read.All or Files.ReadWrite.All
then, your requests to /drive/root/children will no longer return an empty array.
I just had a typo in the User:
https://graph.microsoft.com/v1.0/edffcd1c-e5b2-42f2-b554-XXXXXXXXX/drive/root/children
was supposed to be
https://graph.microsoft.com/v1.0/users('edffcd1c-e5b2-42f2-b554-XXXXXXXXX')/drive/root/children
You can also use this endpoint
https://graph.microsoft.com/v1.0/me/drive/root/children
and pass authorization header Bearer Token
There are two things:
1) First check if the user has given the permission for
Files.Read.All or Files.ReadWrite.All
2) The following endpoint didn't work for business account
/drive/root/children
I changed it to
/drives/{drive_id}/root/children
and it worked fine. Please check.

What is the ALM REST URL for the list of users under a project

I am trying to get the users which are availale for assignment under an ALM project. The same list of users you get when you click the "Assigned to" and "Assigned to (name)" headers in the browser client of ALM.
I have searched around the web trying to find a resource for this, but without luck. I have also tried to guess, e.g. like:
https://url/qcbin/api/domains/domain/projects/project/users or https://url/qcbin/api/domains/domain/projects/project/accounts etc.
Using ALM 12.21
Anyone knows?
Please have a look at the customization command, for instance:
Description
The data on the specified project user.
URL
/qcbin/rest/domains/{domain}/projects/{project}/customization/users/{user name}
Operation to be performed is a GET in this case. You can refer to the REST API documentation.
This gives you the project users. Hope this clarify your query! Have a nice day.

Autocomplete testing on Azure Search explorer

I am trying to build and test the auto complete feature on a master item lookup tables using Azure Search (for a ASP MVC application). The search index was done with the suggesterName SG set to ItemDisplayName
I was looking to test it first on Azure portal- so that I could aim to replicate the results via code. This is because the results I am getting in code are quite unexpected
As I type the substring the itemDislayName, the expectation was that upto 5 selected names will be displayed
On the portal, I tried a query string of
search=str&suggesterName=SG
with the base request URL containing the index, api version and sugestorName-but I don't get results of items containing 'str' and with the fuzziness as below
Could you please guide around
[1] how I can get suggestor output in azure portal-search explorer
[2] can I control fuzziness using queryType and ~1,~2
I was referring to these 3 links
1) https://learn.microsoft.com/en-us/rest/api/searchservice/suggestions
and
2) https://channel9.msdn.com/Shows/Azure-Friday/Azure-Search-103-Azure-Search-Suggestions-with-Liam-Cavanagh
3) gunnarpeipman.com/2016/07/azure-search-suggesters/
Azure Search Portal doesn't support the Suggestion API yet. You will need to use an HTTP client like Fiddler or Postman.
Make sure you use the right URL for you Suggest requests:
https://[service name].search.windows.net/indexes/[index name]/docs/suggest
Please use our User Voice page to vote for adding the Suggest API to the Portal: https://feedback.azure.com/forums/263029-azure-search