web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

I upload a annotation, but its empty

(0) ShareShare
ReportReport
Posted on by 225

I'm able to create records of entities and want to upload annotations (file attachments) but while the annotation is created and I get the GUID for the annotation, its completely empty holding no data.

I implemented, actually copy & pasted, the code from SDK\SampleCode\CS\BusinessDataModel\Annotation in samples in the SDK. Are there any other tricks to it? As mentioned I get a GUID in return that is a GUID for a empty annotation. 

            Annotation setupAnnotation = new Annotation()
            {
                Subject = "Example Annotation",
                FileName = "ExampleAnnotationAttachment.txt",
                DocumentBody = Convert.ToBase64String(new UnicodeEncoding().GetBytes("Sample Annotation Text")),
                MimeType = "text/plain"
            };

            // Create the Annotation object.
            var guid = _orgService.Create(setupAnnotation);

This should be rather simple, but if I use CRM REST Builder to fetch the annotation with that GUID everything is empty:

filesize: null ,
overriddencreatedon: null ,
objecttypecode: null ,
mimetype: null ,
documentbody: null ,
filename: null ,
notetext: null ,


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hi Lars,

    The behavior is odd. Normally if there is an exception, the entire transaction is rolled back and the record is not created at all.

    Where are you getting the GUID from? What table are you querying via the REST request?

    If you try to retrieve the same record, via the Organization.svc Service with all columns, do you see any differences?

  • ashlega Profile Picture
    34,477 on at

    Working fine for me. Try fetching your annotation like this:

    http://<ORGURL>/api/data/v8.2/annotations(GUID, NO BRACES)

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Lars,

    Try using the code below and see if it works.

                Entity note = new Entity("annotation");
                note["subject"] = subject;
                note["filename"] = filename;
                note["documentbody"] = Convert.ToBase64String(data);
                note["objectid"] = new EntityReference("contact",entityId);
                Guid attachmentId = service.Create(note);

    where

    entityId = Guid / ID of the entity in CRM for which we are retrieving the attachments

    subject = Subject of the note that we are creating

    filename = The name of the file we are attaching to note

    data = the content of the file we are attaching to note

    service= CRM organisation service you are connecting to.

    See: http://www.powerobjects.com/2015/01/21/retrieve-and-create-attachments-associated-to-notes-of-an-entity-in-dynamics-crm/

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans