none
create appointment with different owner RRS feed

  • Question

  • Hi,

    while creating appointments using ews, we discovered that we could not set a different owner ( owner of appointment is always the impersonated user).

    We're close to a solution manipulating mapi attributes and we believe that our missing information is PR_SENT_REPRESENTING_ENTRYID and probably PR_SENDER_ENTRYID.

    The problem is that is is binary content and we don't know how to generate it ( we have a string representation using mfcmapi but it does not give which structure it comes from).

    Any idea how to programmatically generate the binary content that has to be set in these 2 entries?

    Or even better, a working sample showing how to create an appoitment with a different owner?

    Thanks in advance.


    -- Emmanuel Dreux http://www.cloudiway.com

    Wednesday, January 20, 2016 9:28 PM

Answers

All replies

  • The Value in the PidTagSenderEntryId https://msdn.microsoft.com/en-us/library/ee179306(v=exchg.80).aspx depends on the Address being used in the Sender Address properties and will be either a OneOffAddressId for SMTP address (generally a external sender) https://msdn.microsoft.com/en-us/library/ee202811(v=exchg.80).aspx or the AddressBookEntryId for Internal users (or contacts) that are resolvable in the Global Address List https://msdn.microsoft.com/en-us/library/ee160588(v=exchg.80).aspx . If you use something like OutlookSpy it will show the Id in a parsed format when you access an Item.

    Cheers
    Glen

    Thursday, January 21, 2016 5:16 AM
  • Thanks for this very valuable information.

    Are you aware of any existing dotnet / C  structure or class to help manipulate them?

    Else we might endup with dozens, if not hundreds, tests until we find the right syntax.

    Regards.


    -- Emmanuel Dreux <a href="http://www.cloudiway.com" title="IAM and migration solutions for the Cloud"> http://www.cloudiway.com</a>

    Thursday, January 21, 2016 7:46 PM
  • >>Else we might endup with dozens, if not hundreds, tests until we find the right syntax.

    The Id formats are fully documented https://msdn.microsoft.com/en-us/library/ee160588(v=exchg.80).aspx so while you should have a few tests if your building your own it shouldn't be a problem.

    If you can use MAPI then http://www.dimastr.com/redemption/rdo/rdoaddressbook.htm will give you everything you need, otherwise EWS won't return the Id directly using its Address look operations but if created a temporary contact with that address you could then get the correct Id back from that contact entry (you want to test that though as well).

    Cheers
    Glen

    Friday, January 22, 2016 1:30 AM
  • works perfectly.

    Thanks.


    -- Emmanuel Dreux <a href="http://www.cloudiway.com" title="IAM and migration solutions for the Cloud"> http://www.cloudiway.com</a>

    Wednesday, January 27, 2016 12:50 PM
  • Hmm,

    just a last and probably silly question.

    In which format do I send the result?

    In the debugger, I managed to have the same string than what I'm seeing in mfcmapi.

    For example: 

    00000000812B1FA4BEA310199D6E00DD010F54020000018074006500730074006f006e006500400063006c006f007500640069007700610079002e0063006f006d00000053004d0054005000000074006500730074006f006e006500400063006c006f007500640069007700610079002e0063006f006d000000

    I then try to send it in the following format:

    return Convert.ToBase64String(GetBytes(mystring));

    or

    return ByteArrayToString(GetBytes(mystring));

    private string ByteArrayToString(byte[] ba) { StringBuilder hex = new StringBuilder(ba.Length * 2); foreach (byte b in ba) hex.AppendFormat("{0:x2}", b); return hex.ToString(); } private byte[] GetBytes(string str) { byte[] bytes = new byte[str.Length * sizeof(char)]; System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); return bytes; }

    ExtendedPropertyType pr_senderENTRYID = new ExtendedPropertyType();
    PathToExtendedFieldType epExpr_senderENTRYID = new PathToExtendedFieldType();
    epExpr_senderENTRYID.PropertyType = MapiPropertyTypeType.Binary;
    epExpr_senderENTRYID.PropertyTag = "0x0C19";
    pr_senderENTRYID.ExtendedFieldURI = epExpr_senderENTRYID;
    pr_senderENTRYID.Item = BuildSenderID(ownerEmail, ownerEmail);


    The result is garbage when I look at the result.


    -- Emmanuel Dreux <a href="http://www.cloudiway.com" title="IAM and migration solutions for the Cloud"> http://www.cloudiway.com</a>


    Wednesday, January 27, 2016 3:13 PM
  • got it.

    Converted string to hexstring then to base64


    -- Emmanuel Dreux <a href="http://www.cloudiway.com" title="IAM and migration solutions for the Cloud"> http://www.cloudiway.com</a>

    Wednesday, January 27, 2016 11:28 PM