아래와 비슷한 코드를 사용하여 해당 파일을 읽고 데이터를 인코딩 한 다음 해당 엔티티에 첨부 된 새로운 주석을 만들 수 있습니다. 어떤 이유로 든 초기 바인딩을 사용하는 경우 늦은 바인딩을 사용했습니다. 나에게 당신이 얼마나 알려
FileStream stream = File.OpenRead("pathToFile");
byte[] byteData = new byte[stream.Length];
stream.Read(byteData, 0, byteData.Length);
stream.Close();
string encodedData = System.Convert.ToBase64String(byteData);
Entity annotation = new Entity("annotation");
annotation.Attributes["subject"] = "My subject";
annotation.Attributes["notetext"] = "My note text";
EntityReference noteRef = new EntityReference();
noteRef.LogicalName = "myEntity";
noteRef.Id = myEntity.Id;
annotation.documentbody = encodedData;
annotation.filename = "myFile.doc";
annotation.mimetype = @"application\ms-word";
annotation.Attributes.Add("objectid", noteRef);
annotation.Attributes.Add("objecttypecode", "myEntity");
service.Create(annotation);
,
감사합니다.
안녕하세요, 주석 클래스의 documentbody, filename 및 mimetype 속성에 액세스하는 중에 오류가 발생했습니다. – skub
아마 Attributes 컬렉션을 통해 액세스 해보십시오. annotation.Attributes [ "documentbody"]. 그들은 분명 거기에 있어야합니다. 이 기사는 해당 속성의 설정을 확인합니다. http://msdn.microsoft.com/en-us/library/gg328429.aspx. 어떻게 지내는지 알려줘. –