SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a method which will convert the word documents in a sharepoint library into PDF.

public WordToPDF(string fileName, string filePath, string userName, string passWord)

    //Code to convert word to PDF.


I can give the username and password hardcoded.But in runtime I am unable to use this method.Because you are unable to retrive the password in sharepoint.So How can I modify the above function? Thank YOU.

share|improve this question
Can you provide some more details? Where is this method coming from, what are you using for the underlying PDF Conversion? Is this a third party SharePoint PDF Converter or something you wrote yourself? – Muhimbi Mar 7 '11 at 10:02

Where are you getting an access error at? If the code is running through SharePoint, it will use the credentials of the currently logged in user. If the code is running outside of SharePoint, then you'll need to setup credentials object.

With the information you provided, I would guess that you should just remove the username and password part of the method and let it run with the current user's security level. I wouldn't recommend manually overriding the credentials for this because it opens up possible modifications by users who aren't allowed to modify files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.