Hi guys, I am trying to attach a document from a sharepoint document library to an email event message, but all my workflow instances go to an error state :
Could not load file or assembly 'Microsoft.SharePoint.Library, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
I have referenced the dll but I am still getting the error, please advice
Thanks in advance.
Please find the server object model code below:
can i use the client object model instead of the server object model ???
try
{
string siteUrl = K2.ProcessInstance.DataFieldsc"MossSiteUrl"
].Value.ToString();
using (SPSite site = new SPSite
(siteUrl))
{
using (SPWeb
web = site.OpenWeb())
{
web.AllowUnsafeUpdates =
true
;
//ApplicantDocuments
string fileName = K2.ProcessInstance.Folio.Replace("/", "_") + "incompleteinformationletter.pdf"
;
string url = siteUrl + "/" + "ApplicantDocuments" + "/"
+ fileName;
SPFile
file = web.GetFile(url);
//
byter] buffer = (byte
;])file.OpenBinary();
System.IO.
MemoryStream ms = new System.IO.MemoryStream
(buffer);
this.EmailMessage.Attachments.Add(new Attachment(ms, "AcknowledgementLetter.pdf"
));
web.AllowUnsafeUpdates =
false
;
}
}
}
catch (Exception
ex)