Dears,
I used a SmartObject WCF service to create a document in a SharePoint library, but each time I uploaded the document I found that the uploaded document's name is "noname".
So can any one help with some code to upload a document using SO to SP library?
This is my code
// fullPath is the path to the document which is needed to upload
// attachment is the SO
// aClient is SO client
using (FileStream reader = new FileStream(fullPath, FileMode.Open))
{
byte[] buffer = new byte[reader.Length];
reader.Read(buffer, 0, (int)reader.Length);
attachment.Title = "mail.msg";
attachment.File_K2_ServiceDefined = Convert.ToBase64String(buffer);
}
aClient.AttachmentsSvc_Create(attachment);
Thank you,
Mostafa.