locked
creating Email getting error : RRS feed

  • General discussion

  • Hi Team

    Below is the code. I have written for email creation by late binding:

    Entity[] toArray = new Entity[to.Entities.Count()];
                    var count = 0;
                    foreach (var item in to.Entities)
                    {
                        Entity emailToEntity = new Entity(Email.ActivityParty);
                        emailToEntity["partyid"] = new EntityReference(Email.Systemuser, item.Id);
                        toArray[count] = emailToEntity;
                        count++;

                    }

                    //Entity emailFromEntity = new Entity(Email.ActivityParty);
                    //emailFromEntity["partyid"] = new EntityReference("queue", from);

                    Entity[] ent = new Entity[1];
                    ent[0] = new Entity(Email.ActivityParty);
                    ent[0].Attributes["partyid"] = new EntityReference("queue", from);

                    Entity entity = new Entity(Email.SchemaName);
                    entity[Email.From] = ent;// new Entity[] { emailFromEntity };
                    entity[Email.To] = toArray; //new Entity[] { emailToEntity };
                    entity[Email.Subject] = subject;
                    entity[Email.Description] = bodyText;
                    entity[Email.Owner] = new EntityReference(Email.Systemuser, ownerId);
                    entity[Email.RegObjId] = "model id";
                    Guid emailid = organizationproxy.Create(entity);

    The Below Error I am getting.:

    systemuser With Id = fa0c6845-b439-e411-9d0b-005056ba9f90 Does Not Exist. the Guid is a QueueID

    please Help me..

    Thanks 

    Naveen 


    Naveen

    Tuesday, October 21, 2014 8:26 AM

All replies

  • hi Naveen,

    please check if you are assigning the ownerof email as a queue insteadof a system user?

    the error message says so. You got to add a break point and see which entry reference corresponds to that guid and verify.

    regards

    Jithesh

    Tuesday, October 21, 2014 8:32 AM
  • Thanks Jithesh for quick reply.

    you are correct. I am assigning the wrong Id to system user.

    Thanks Once again for the quick help.

    Naveen Dasari 


    Naveen

    Tuesday, October 21, 2014 8:42 AM
  • Hey Buddy,

    Mark the reply as ans if it helped you :)

    Jithesh

    Tuesday, October 21, 2014 10:41 AM