I followed [this][1] to convert a SharePoint List Item to word (and then word to PDF). I am using a dotx template file from a Document Library to create a word file and save it in the same doc library. When I deployed this custom solution on test server it worked fine(worked fine on Dev too), but when I move the same solution to Production, I get "Error :Access to the path '\SERVERNAME\sites\SITENAME\DOCLIBNAME\Forms\StaffTemp.dotx' is denied."

Here is how I am copying the file.... string templateFile = "\\SERVERNAME\sites\SITENAME\DOCLIBNAME\Forms\StaffTemp.dotx";

string destinationFile = "\\SERVERNAME\sites\SITENAME\DOCLIBNAME\" + filename + ".docx";

File.Copy(templateFile, destinationFile, true); File.SetAttributes(destinationFile, FileAttributes.Normal);

Can anyone tell me what I can do to solve this? Thank you.

  • 2
    Please fix your link and formatting. May 24 '18 at 20:53
  • This link works without any error in dev and test server. I am getting error only in production. Also I don't see any error in this link.
    – Kalai
    May 29 '18 at 13:26
  • I was referring to your original post. The link isn't present. May 29 '18 at 15:01
  • I'm sorry. Here is the link blogs.msdn.microsoft.com/vsod/2012/02/17/…
    – Kalai
    May 29 '18 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.