I'm developing a Webpart and I need to go through every document library and get its permissions. Basically I need to get the groups and its permissions associated with the document library.
I have iterated through the properties and methods of a SPDocumentLibrary object but couldn't find anything really.
Any help or guide would be appreciated.
Thank you
I would first check HasUniqueRoleAssignments. If it is false, then the permissions for that document library are inherited from the website. If it is true, as Jason said, I would then check the Member and RoleDefinitionBindings of each SPRoleAssignment.
Try SPDocomentLibrary.RoleAssignments.
This will give you SPRoleAssignments where the Member property is a SPGroup or a SPUser.
Related
I've been looking at the Dropbox and Dropbox for Business API and I was trying to see if it would be possible to create a list of all the members and what shared folders they have access to.
I have found a project by Dropbox (Github Source) that lists all the shared folders and which people have access to them. I essentially want to do the opposite, list the users and what folders they have.
I have read through all the API (Core and Business) docs but can't seem to find a way to do it, unless I'm missing something. I also read about a preview of the new API, but again I don't think that is what I want.
Does anyone know if this can be done?
If I understand correctly what you're trying to do, you just need to call /shared_folders for each member of the team.
(You can list the members of the team via /team/members/list.)
Can you advise??
I am trying to programmatically insert file permissions in OneDrive , OneDrive for business, SharePoint Online, not unlike how you can do it on Google Drive.
ie: https://developers.google.com/drive/v2/reference/permissions/insert
I cannot locate a OneDrive API scope/method to use to insert file permissions? (in effect to programmatically share a file). Does anyone happen to know if this is possible, and if so which scope/method to use? I assume its something such as SetPermission?
I am aware that you can get a link via the 'wl.skydrive' scope within OneDrive API although it is unclear as to whether there are any permissions added ?
Thank you in advance
James
The closest analog is shared edit and shared read links:
http://msdn.microsoft.com/en-us/library/dn631815.aspx#get_links_to_files_and_folders
If you are building a SharePoint app, you might want to try using the SPRoleAssignment class, which might also work for OneDrive for Business:
http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.sproleassignment(v=office.15).aspx
Basically, you create a group, add permissions level, and then assign that to an item.
You can also use the UpdateDocumentSharingInfo method (http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.sharing.documentsharingmanager.updatedocumentsharinginfo(v=office.15).aspx) from the DocumentSharingManager class to share internal files in OneDrive for Business.
Here’s how to make the call:
DocumentSharingManager.UpdateDocumentSharingInfo(
_ctx,
_resourceURL,
new List() { _newRoleAssignment },
validateExistingPermissions: true,
additiveMode: true,
sendServerManagedNotification: false,
customMessage: null,
includeAnonymousLinksInNotification: false);
_ctx.ExecuteQuery();
I need to create a workflow that would break permission inheritance in a sharepoint subsite.
I am building a sharepoint 2010 site that is highly modular and can expand based on clients needs. The project requirement is that the client must be able to expand the website and add subsites from templates with as little interaction as possible. To this end I have created a list and attached a workflow to this list that creates a new website based on the information supplied in the list fields. The workflow I am using is a solution I found online http://www.ilovesharepoint.com/2011/02/create-site-action-sharepoint-designer.html
After the website is created I need to create security groups (another workflow I found online helps with this).
The problem is that the subsite must inherit security groups from the parent site and then I need to add new ones. In order to do this I need to break inheritance from the parent site and than I can create new groups. Currently my client has to do this manually - very bad thing. So I need create a workflow that would do just that.
The problem is that I am completely clueless as to how to go about doing this.
Ideally, I would like to create some sort of workflow action that would take a site url as input and then break permission. From what I've been able to find I need to use BreakRoleInheritance function to do that. but how do I create a workflow that takes input and how do i convert the string input into an actual site?
Like I said, I don't know anything about coding for sharepoint so please be as specific as possible.
Thank you very much.
P.S. maybe I am mistaken and i don't need to break inheritance to create additional security groups that would work only for a given subsite. If so, please tell me how to do this without breaking inheritance.
I'm trying to programmatically determine whether the current user has certain permissions on a given Active Directory object (specifically in this case, I'm trying to determine whether the user has the "Send As" permission for another Exchange user or distribution list object).
I already figured out how to access the ntSecurityDescriptor attribute using ADSI: I can enumerate the ACEs in the IADsSecurityDescriptor's DiscretionaryACL property. But:
How do I determine from that data whether the "Send As"-permission is explicitly allowed or denied for a trustee?
How do I discover this when the permission has been granted indirectly via group membership? Do I really have to parse the effective permissions myself by (recursively) checking all groups the user is a member of? Surely there must be an API for that task...
FWIW, I'm coding in Delphi (i.e. native Win32 code) using the ActiveDs.dll typelibrary, so .NET-specific solutions won't really help me much unless their source code gives me clues to how to do the same thing in native code. The same goes for PowerShell.
Before anyone starts: I already know about the PR_EMS_AB_PUBLIC_DELEGATES and PR_EMS_AB_PUBLIC_DELEGATES_BL_O Extended MAPI properties. However, this is not what I'm after. These properties refer to the "Send on behalf of"-right (a.k.a. delegates), not the "Send As" permission, which is quite a different thing.
Here's the MSDN article that explains - http://msdn.microsoft.com/en-us/library/windows/desktop/ms675580(v=VS.85).aspx. There is an attached sample that shows how to call the API.
I've been away from SharePoint development for quite a while now, and I'm trying to access the information in a SharePoint 2010 blog (from one of our users, within their "MySite") from a C# webpart which will reside on the homepage of the site. The idea is to be able to highlight a certain user's latest post on the home page.
Can anyone help me to reference the blog (in dev it is located at http://myServer/my/BillsBlog) from our homepage. I've tried the following...
Reference an SPSite giving the URL as a constructor parameter, then get the correct web from there. This fails. (I'm guessing the blog is a web, rather than a site collection, but am open to being corrected there)
Get the current context from SPContext.Current, and access the AllWebs collection from there, but this doesn't inculde the /my web.
Once I find the appropriate container (SPSite or SPWeb) I can access the list to pull out the items I need, but I don't know how to get to that point. In a console App, I have it working by using the method in the first bullet abouve.
I'm really pretty much stuck now, and I simply don't know enough about what I'm looking fro to be able to search Google for answers. Any help you could give me would be greatly appreciated.
OK, my mistake. The webpart project was set up as a sandboxed one, so the approach in bullet 1 wouldn't work. Changing that switch meant it is now OK and working as per the console app.
Thanks for reading.