question

WesleyLoo-2057 avatar image
0 Votes"
WesleyLoo-2057 asked saldana-msft edited

Getting certain properties from document libraries and SharePoint admin center

Using the SharePoint REST API to get certain properties (Graph API didn't seem to provide the properties that I'm looking for):

  • "EnableVersioning" property; was able to get the property for document libraries on the default "Communication site". How can I get this same property for document-libraries of user-created sites? API call I used to get settings for default site libraries: "{site_url}/_api/web/lists?$filter=BaseTemplate eq 101"

  • Settings under the SharePoint admin center, screenshot provided:
    87919-image.png

Looking to get resources represented on this page; for example, the value for the duration to expiration for "Anyone links".

Could I get some guidance on REST API endpoints that could be used to get these resources?

office-sharepoint-onlinemicrosoft-graph-sites-lists
image.png (109.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
1 Vote"
MichaelHan-MSFT answered WesleyLoo-2057 commented

Hi @WesleyLoo-2057,

  1. It's the same as you get on the default "Communication site". For example: the site url is https://tenant.sharepoint.com/sites/test. The api call would be like this: https://tenant.sharepoint.com/sites/test/_api/web/lists?$filter=BaseTemplate eq 101&$select=EnableVersioning,Title .

If you want to get the porperty for a specific library, you could use this api call :

 https://tenant.sharepoint.com/sites/test/_api/web/lists/getbytitle('Documents')

87994-image.png


2.To get settings for SharePoint admin center, the api should be: https://tenant-admin.sharepoint.com/_api/Microsoft.Online.SharePoint.TenantManagement.Office365Tenant

The property RequireAnonymousLinksExpireInDays is the duration to expiration for "Anyone links".



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.








image.png (29.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, it works! Although for the second part of your answer, it only worked when I removed the "-admin" from the beginning of the url. So the call that allowed me to get the admin properties was:

 https://{tenant}.sharepoint.com/_api/Microsoft.Online.SharePoint.TenantManagement.Office365Tenant

Is there any documentation associated with these admin properties? I've been having trouble finding anything resembling this solution online.

0 Votes 0 ·