MOSS 2007: Programmatically Open Shared Document as Read Only for Certain Roles, and Editable for Others

StackOverflow https://stackoverflow.com/questions/16822936

문제

I would like to show the Shared Documents on a sub-site of a main site. Many subsites will be created, all with a Shared Docs library and a Word doc titled identically, but different content

We have methods to see if the current user is an admin or one of our custom roles (not a SP role)

I'd like programmatically open documents in the Shared Docs library in Read Only mode for certain roles (SP and custom), and enable editing for other roles

I have been researching all day long but have not yet found a way to say SPFile or SPListItem.Open(). I have found the checkout() methods but I don't think it can help.

Any help would be gratly appreciated. Thanks is advance

도움이 되었습니까?

해결책

I would set unique permissions on the document library or individual documents, giving the roles the desired permission (Contribute to allow editing or Read Only to allow read only). You can still open the documents programmatically, but the user will not be able to write the document back to SharePoint if they've been given Read Only access. No code required to accomplish this. As far as I can see, this is the only way to open the documents the way you want.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top