我正嘗試使用SharePoint的CopyService上傳文件。它工作正常,直到我意識到當文件名以'。'結尾時。 (點)例如測試。 .docx,test ... docx,test .... docx等。我將CopyResult作爲無效的URL。使用CopyService上傳文件錯誤SharePoint
我不是100%確定如果這些名稱是有效的,應該像簡單的文件名稱上傳,或者我應該顯示錯誤消息說我的用戶無效的文件名。
請幫忙。
我的代碼 -
public static void CopyImageOnServer(string sourceUrl, string destinationUrl, byte[] fileData)
{
PBSWebApplication.CopyServiceReference.CopySoapClient proxy = Utility.GetServerCopyProxy();
// List of desination Urls, Just one in this example.
string[] destinationUrls = { Uri.EscapeUriString(destinationUrl) };
// Empty Field Information. This can be populated but not for this example. SharePoint2007CopyService.FieldInformation information = new SharePoint2007CopyService.FieldInformation(); SharePoint2007CopyService.FieldInformation[] info = { information }; // To receive the result Xml. SharePoint2007CopyService.CopyResult[] result;
// Empty Field Information. This can be populated but not for this example.
CopyServiceReference.FieldInformation information = new CopyServiceReference.FieldInformation();
CopyServiceReference.FieldInformation[] info = { information };
// To receive the result Xml.
CopyServiceReference.CopyResult[] result;
uint returnValue = proxy.CopyIntoItems(sourceUrl, destinationUrls, info, fileData, out result);
if (result[0].ErrorCode != CopyServiceReference.CopyErrorCode.Success)
{
// ...
}
}
感謝。