Get SharePoint Hub Site associated Sites CSOM - rest

How do we get or retrieve the associated sites in a SharePoint hub site using CSOM or REST API? I don't find API methods for this. Please suggest me a solution.
Thank you.

You can use the REST API below to get information about all hub sites that the current user can access.
/_api/HubSites
Refer to: https://learn.microsoft.com/en-us/sharepoint/dev/features/hub-site/rest-hubsites-method
More information:
Hub site REST API

Mikael Svenson has a blog post - you can use the SharePoint Search REST API, querying on the managed property called DepartmentId.
More information available here: https://www.techmikael.com/2018/04/working-with-hub-sites-and-search-api.html
An example of a REST call that returns all sites that are joined to a specific hub site (NOT including the hub site itself):
https://<hostname>/_api/search/query?querytext='contentclass%3dsts_site AND NOT siteid:<hubsite-id> AND departmentid%3d{<hubsite-id>}'&refinementfilters='departmentid:string("{*"%2clinguistics%3doff)'&trimduplicates=false
And an example of the same REST call but this time including the hub site itself:
https://<hostname>/_api/search/query?querytext='contentclass%3dsts_site AND departmentid%3d{<hubsite-id>}'&refinementfilters='departmentid:string("{*"%2clinguistics%3doff)'&trimduplicates=false
<hostname> = host to your sharepoint web app, like contoso.sharepoint.com
<hubsite-id> = id (GUID) of the hub site

Related

Microsoft graph-api endpoint to view admin center global tenant settings

Is it possible to get global tenant settings via a graph api endpoint? For example, if I want to programmatically determine if my tenant's sharepoint settings limit external sharing by domain, is there a graph api endpoint for this? Based on my research I have yet to find an endpoint that gives me access in either v1 or beta (https://learn.microsoft.com/en-us/graph/api/reportroot-getonedriveactivityuserdetail?view=graph-rest-1.0)
It does seem possible to gather this information via powershell using the SharePoint Online module by doing
Get-SPOTenant | fl SharingDomainRestrictionMode,SharingAllowedDomainList
For added context here is the same setting in the sharepoint admin center:
If admin center endpoints (SharePoint, OneDrive, Azure AD, etc.) are not currently available in the graph api are they on the future roadmap?
Thank you in advance for any insight you can provide.
Currently it is not supported and its not under road map.
Please raise user voice.

Is there a complete list of sharepoint online rest api from official docs?

As title said, Is there a complete list of sharepoint online rest api from official docs?
I've done some research. However from the MS docs I can only find Complete basic operations using SharePoint REST endpoints and Get to know the SharePoint REST service.
Or maybe there just isn't one for the current Sharepoint Online implementation from official docs which have REST api reference and samples.
I was consider using MS graph as well, however it seems at the moment, the operations exposed by the Graph for SharePoint are very limited when compared to the native SharePoint REST API.
If there is a list, please share.
REST APIs of SharePoint are conformed to the specification of OData, we can use it like we use other OData APIs.
Here you go:
REST API reference and samples
More information about OData, we can refer to: OData - the best way to REST
If you have been authenticated (e.g. have an access token) and you can use the SharePoint API, then you can get a list of available endpoints for GET requests:
https://[tenant].sharepoint.com/[site]/_api/Web
The first part of the response provides a list of endpoints that you can explore further. [site] can be requested at any level (there can be many subsites below).
For example:
https://[tenant].sharepoint.com/[site]/_api/Web/SiteUsers
will allow you to display a list of users on a site and other possible endpoints, and
https://[tenant].sharepoint.com/[site]/[subsite]/_api/Web/Lists
will display all the lists that belong to the given subsite.
Unfortunately, I was not able to get a list of endpoints for POST requests such as: _api/web/lists/getByTitle('Documents')/breakroleinheritance(copyRoleAssignments=false, clearSubscopes=true)

How do I get a list of TFS Collections over REST?

I'm working with the REST API for Team Foundation Server and Visual Studio Online. I am looking for a rest call which will tell me what collections the user has access to.
I cannot find a REST call which will allow me to view this information. Is there a REST call that will let me view this information for an authenticated user?
Try this:
[tfs url]/_api/_common/GetJumpList?showTeamsOnly=false&__v=5&navigationContextPackage={}&showStoppedCollections=false
You can capture the request by using developer tool: Using Windows Internet Explorer Developer Tools Network Capture
The following works for Azure DevOps 2020:
[tfs url]/_apis/projectCollections?$top=1000

Impersonation on ToDo Items via X-LConn-RunAs using the IBM Connections REST API

I have successfully posted data to IBM Connections using the X-LConn-RunAs Header in my API calls to create Activity Stream Entries, Blog Posts, Wiki Pages, Forum Entries and File Uploads on behalf of someone else although it is not documented in some of the APIs. The only API that does not seem to support this Header is the Activity API. Here is what I did:
I added my technical user to the "trustedExternalApplication" role in the "WidgetContainer" application.
I added my technical user to the "admin" role in all other applications.
I added the X-LConn-RunAs Header to my api call like this: X-LConn-RunAs: userid=D2A7325-...
I made sure the referenced user exists in IBM Connections.
I sent my call to: http://myconnections/activities/service/atom2/activity?activityUuid=GH765...
The post is still being created with the technical user as creator instead of the user referenced by X-LConn-RunAs. I tested this against my on premises IBM Connections 5.0 installation as well as IBM Connections Cloud. While all other API calls support this Header the Activities don't.
Did anybody have more luck than myself and figured out how to use it or is there another way to achieve the same result with a different header or some additional information in the message body? I tried to send an <author> element but that is being ignored as it says in the documentation.
As just heard in an IBM Connect 16 session (you are sitting left of me ;-) ), as of today Impersonation of activity stream and status update data is not possible

Get user list using Confluence prototype REST API

I have a prototype API which will return all the content from the confluence instance including users. The rest endpoint is https://confluenceinstance.atlassian.net/wiki/rest/prototype/1/search.json?query=
Is there a way I can get only the users in the system? I tried sending query=user which gave me irrelevant response. Any leads would be appreciated. Thank you.
I am not sure about hosted version of confluence, but in dedicated version you can download the Rest API Browser addon that would list all rest services and from there you can find that user-management/1.0/users returns a paginated list of users.