How to list all personal sharepoint sites using microsoft graph? - sharepoint

I want to fetch following data using Microsoft graph API
All the root sites(group + personal)
All group root sites
All personal root sites
For the first case currently I am using https://graph.microsoft.com/v1.0/sites in order to find out all the root sites
For the second one I am using https://graph.microsoft.com/v1.0/sites?search=contentclass:STS_Site to find out all group sites.
I am not sure how to which API I can use to find out only personal sites. Do graph API have any filter which does that? Also is there a way to solve point 1 and 2 in a better way?

#Mridul Sharma,
Please take a reference of below steps:
There is a hidden list called "DO_NOT_DELETE_SPLIST_TENANTADMIN_ALL_SITES_AGGREGA" in the admin site. It stores a cached copy of aggregated site collections data from all contentDB.
https://graph.microsoft.com/v1.0/sites/tenant-admin.sharepoint.com/lists
Get all sites
https://graph.microsoft.com/v1.0/sites/tenant-admin.sharepoint.com/lists/90403211-a51b-4a2b-8e83-a569011b63f7/items?$expand=fields
Use the filter to get all personal sites
https://graph.microsoft.com/v1.0/sites/tenant-admin.sharepoint.com/lists/90403211-a51b-4a2b-8e83-a569011b63f7/items?$expand=fields&$filter=fields/TemplateId eq 21
BR

Related

Is it possible through the REST api to retreive which sites a specific user is following in Sharepoint?

Using the SharePoint REST api or search API, is it possible to retrieve a full list of all the sites a specific user is following? All I can find in the documentation is https://<sharepoint>/_api/social.following/my/followed(types=4) which only works for the current logged in user.
I don't think this is possible. The below are the only available endpoints:
Follow
StopFollowing
IsFollowed
My
My/FollowedDocumentsUri
My/FollowedSitesUri
My/Followed
My/FollowedCount
My/Followers
My/Suggestions
GetMySuggestions
IsMyPeopleListPublic
AmIFollowedBy
GetPeopleFollowedBy
GetFollowersFor
Reference

Access files of Document Library site through Microsoft Graph API

I was wondering if the two following queries are actually the same or supposed to be the same:
GET https://graph.microsoft.com/beta/sharepoint/sites/{spsite-id},{spweb-id}/drives
and
GET https://graph.microsoft.com/beta/sharepoint/sites:/MYPATH:/drives
I would like to access a Document Library Item in a sharepoint site through the relative path.
Please mind that both endpoints below are the same for getting all doc libraries or drive in a site according to the current beta microsoft graph documentation. The latter becomes handy when you dont know the site id yet but the relative site url.
https://graph.microsoft.com/beta/sites/[domain.sharepoint.com]:/[relative-url]:/drives
https://graph.microsoft.com/beta/sites/[site-id]/drives
(e.g. site id: "cie493742.sharepoint.com,4af352a7-a53b-43d9-b0a3-da372b392ea0,52c490f3-3354-40b9-a3c9-fefb08cb5c88" )
Now to get the document library item
Get Document library id from list of drives
https://graph.microsoft.com/beta/sites/[site-id]/drives
Get item id from list of items
https://graph.microsoft.com/beta/sites/[site-id]/drives/[drive-id]/items
Final API call
https://graph.microsoft.com/beta/sites/[site-id]/drives/[drive-id]/items/[item-id]
you could try experimenting the Graph API from here

SharePoint Hosted App 2013: Customize List/AllItems.aspx page

I'm trying to implement permission levels in SharePoint hosted app. I've created a custom list "Permissions" where I'm adding different users with their roles.
I have created a page List.aspx where I'm showing my custom list "Products" as a list view web part. Page List.aspx checks the user's role against "Permissions" list, and page can show or hide content in regards to this role. The problem is, when user tries to navigate to "Lists/Products/Allitems.aspx" or "Lists/Permissions/Allitems.aspx" he can see the list items.
All code check is done in JavaScript and I know there is a security risk, but this will work for my users. I just need to find a way to inject custom JavaScript code to Allitems.aspx, and to check if user has permissions to see it or not.
Everything here is done on App web and there's nothing that I use on host web.
I've found a workaround for this. Basically what I did is that I just hide the list view from direct access. To achieve this, open the Schema.xml of the list and replace "JSLink":
from
<JSLink>clienttemplates.js</JSLink>
to
<JSLink>~site/Scripts/OverrideListView.js</JSLink>
Now, create a new file Scripts/OverrideListView.js and add following code to it:
document.write("<style>body {display:none; };</style>");
Try now to access Lists/Permissions/Allitems.aspx directly. You will get a blank page.
This is basically idea how to insert custom JS code into list view. You could add additional code for checking current user's permissions on site level and in regards to it to unhide this view, or even to redirect him to the homepage if he does not have right role or permissions.

Displaying Sharepoint User profile information and creating custom search

I have to display user profiles along with their properties in a gridview in a Sharepoint application. Post that it should display results based on the search criteria being made.
I have tried using foreach loop using UserProfileeManager, but it seems very slow when a search is made for 3000 user profiles.
Is there any way to store all the user profile information somewhere in SQL database, or If any webservice can be used.
Kindly help!
Instead of going for seperate SQL DB.
Get the user profile details and store it in SharePoint list on your site.
Perform the search on that list so that it will increase the performance.
To display in gridview you can do it in lot of ways if the data in SharePoint List.
Hope it helps.
don't understand your platform clearly,since you already known store the info in DB,just store it,such as MySQL of windows,*nix and SQLite for android and iOS.Good luck. u wanna do some search,then if it is simple find ,the use sql 'select xxx,yyy from table where ....';that's ok.Good Luck.

WSS site and page permission

I have a simple requirement where a user can input some details using a form.I have created a List and using sharepoint designer generated a customized new entry form which can submit data into list.There are two types of users one end user and second admin.
The problem is ,I have to give permission to the list for end users so that they can fill entry and submit request.This permission allow end end user to jump main site and they able to see list data and other site details.
Is there any way which I can create a group which has only access to that entry (request from) page and not able to browse any other urls
I want to use coding level solution if it is possible with in built functionality.
The new customized form is inbuilt functionality.
Please help .
Thanks
Ritu
you can specific permissions on the list, without giving permissions to the whole site. This way you can even give permissions to only add items. All that could be done using the browser alone

Resources