I am trying to upload a Word Document to my personal box account using Box Windows SDK V2 using the following code.
using (Stream s = new FileStream("C:\\word.docx",
FileMode.Open, FileAccess.Read,
FileShare.ReadWrite))
{
MemoryStream memStream = new MemoryStream();
memStream.SetLength(s.Length);
s.Read(memStream.GetBuffer(), 0, (int)s.Length);
BoxFileRequest request = new BoxFileRequest()
{
Parent = new BoxRequestEntity() { Id = "0" },
Name = TxtSaveAS.Text
};
BoxFile f = await Client.FilesManager.UploadAsync(request, memStream)
The document gets uploaded successfully in root folder but the problem is, the extension of document is set to "File" (which is not previewed by Box because of having unsupported extension, neither it gets the icon of word document) rather than "docx" though it still gets open correctly in Microsoft word. How to upload file using box windows sdk with respective extensions. suggestions are greatly welcomed.