4

I want to get all the document libraries in which current user has full control using rest api.

it seems that we can check using effectiveBasePermissions.

I have used below script :

 function GetModifiedDoclib() { var executor; var appwebUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); executor = new SP.RequestExecutor(appwebUrl); executor.executeAsync({ url: appwebUrl + "/_api/SP.AppContextSite(@target)/web/lists?@target='" + hostwebUrl + "'&$select=Title,effectiveBasePermissions&$filter=BaseTemplate eq 101&$orderby=LastItemModifiedDate desc", method: "GET", headers: { "Accept": "application/json; odata=verbose", "X-RequestDigest": $("#__REQUESTDIGEST").val() }, success: function (data) { var jsonObject = JSON.parse(data.body); var results = jsonObject.d.results; }, error: errorListHandlerXD }); } 

i have make one document library(TestDoc) and havent access of current user.another one document library(Documents) has full control.

my API Output look like :

 {"d":{"results": [{ EffectiveBasePermissions":{"__metadata":{"type":"SP.BasePermissions"}, "High":"2147483647","Low":"4294967295"}, "Title":"Documents"}, {"EffectiveBasePermissions": {"__metadata":{"type":"SP.BasePermissions"},"High":"16","Low":"134283264"}, "Title":"TestDc"}]}} 

My doubt : what are value of High and low indicated in output and how can i know user have full control to document library?

Can you please guide me?

1 Answer 1

3

Here is link of Permission mark with value :

http://www.dctmcontent.com/sharepoint/Articles/Permissions%20and%20Mask%20Values.aspx

http://www.sharepoint-insight.com/2011/10/23/list-of-sharepoint-base-permissions-with-their-hex-and-decimal-values/

I am not found any solution using REST API but i have accomplish my requirement using Client object model.

function GetModifieldDocLib_Privilege() { hostwebUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appwebUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); context = new SP.ClientContext(appwebUrl); factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl); context.set_webRequestExecutorFactory(factory); appContextSite = new SP.AppContextSite(context, hostwebUrl); var oWebsite = appContextSite.get_web(); var collList = oWebsite.get_lists(); this.listInfoArray = context.loadQuery(collList, 'Include(Id,Title,EffectiveBasePermissions,BaseTemplate)'); //Execute the query with all the previous // options and parameters context.executeQueryAsync( Function.createDelegate(this, GetAllDocLibWithPrivilege), Function.createDelegate(this, errorHandler) ); } function GetAllDocLibWithPrivilege() { for (var i = 0; i < this.listInfoArray.length; i++) { var oList = this.listInfoArray[i]; if (oList.get_baseTemplate() == 101) { var perms = oList.get_effectiveBasePermissions(); if (perms.has(SP.PermissionKind.editListItems)) { // get documentlibraries object whose Current-user has Edit Permission. } } } 

Hope its helps!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.