I want to upload files in a document library of sharepoint site (WSS 3.0) using c#, but the problem is that I want to allow only authorized users to upload file. I don't know how to pass user credentials using sharepoint object model. Is there a way to get user credentials from user i.e username, password and then upload file using these credentials. I am asking this because if i use elevated prevelages then I don't know who uploaded the file because file uploaded as system account.
0
votes
2 Answers
1
votes
0
votes
It needs to be custom code and wouldn't be available out of the box.
One approach. You can pass the username to the routine that does the file uploading. You can then enumerate the site users to see a) if the user exists on the site and b) do they have the proper rights to add the document.
Look at the AllUsers property on the SPWeb object (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.allusers.aspx)