문서를 업로드 할 수 있지만보고/다운로드 할 때 오류가있는 것 같습니다. 이 PDF를 열 때 문제가 발생했다고합니다. Ran into a problemCRM 노트에서 SharePoint로 문서 본문 업로드 C#
나는 다음과 같은 코드에게 documentBody
using (var stream = new System.IO.MemoryStream())
{
byte[] myByte = System.Text.ASCIIEncoding.Default.GetBytes(documentBody);
foreach (byte element in myByte)
{
stream.WriteByte(element);
}
stream.Seek(0, SeekOrigin.Begin);
var newFile = new FileCreationInformation { Url = fileName, ContentStream = stream, Overwrite = true };
file = list.RootFolder.Files.Add(newFile);
file.CheckOut();
file.CheckIn(string.Empty, CheckinType.MajorCheckIn);
context.Load(file);
context.ExecuteQuery();
}
을하는 것은 Annotation
(주)에서 필드 documentbody
입니다. stream
에 문제가 있습니까?
그래서 당신은 간단한 문자열 인 documentBody에서 바이트를 작성하여 PDF를 만들려고? PDF를 만들려면 [여기] (http://www.adobe.com/content/dam/Adobe/en/technology/pdfs/PDF_Day_A_Look_Inside.pdf)에 설명 된 형식을 따라야합니다. – rene
감사합니다. @rene하지만 'documentbody'문자열을 사용하여 CRM 문서에 SharePoint 문서를 복사 했으므로 잘 보았습니다. 게다가, 나는 처음부터 PDF를 생성하지 않는다. ... –
비효율 외에이 코드에는 별다른 차이가 없다. 파일 이름은 무엇입니까? 그 문서에는 평범한 텍스트가 있습니까? 그러나 PDF를 반환 할 것으로 기대하십니까? – rene