Interacting with the Exchange Web Services
Upcoming SlideShare
Loading in...5
×
 

Interacting with the Exchange Web Services

on

  • 3,317 views

Tips on using Exchange Web Services to create Contacts, Distribution Lists, extended properties, ...

Tips on using Exchange Web Services to create Contacts, Distribution Lists, extended properties, ...

Statistics

Views

Total Views
3,317
Views on SlideShare
3,308
Embed Views
9

Actions

Likes
0
Downloads
25
Comments
0

1 Embed 9

http://www.slideshare.net 9

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Interacting with the Exchange Web Services Interacting with the Exchange Web Services Presentation Transcript

  • 9 October, 2008
    Interacting with the Exchange Web Services, by Wim De Coninck
  • Exchange Web Services Architecture
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    2
  • Exchange Web Service: Whatcan we do withit?
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008
    • Autodiscover
    • Calendaring
    • Contact
    • Folder
    • Server Management
    • Messaging
    • MIME
    • Security
    • Store EventSinks
    • Store Schemas
    • Store
    • Synchronization
    • Task Item
    • Utility
    • Notification
    • Web services
    3
  • Creating a basic contact
    4
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008
    • Instantiate a ContactItemType
    • Set somepropertieson the contact
    • Specify the folder whereyou want the contact
    • Instantiate a CreateItemType
    • Add the contact to the createItem
    • Invoke the CreateItemmethodon the webservice.
    • Process the response of the CreateItemmethod.
  • Zooming in...
    To set email addresson a contact, create a new List of EmailAddressDictionaryEntryType and add the email address to the array, thenadd the array to the contact’s email addressesproperty…
    var contact = newContactItemType();
    varemails = newList<EmailAddressDictionaryEntryType>
                    {
                        newEmailAddressDictionaryEntryType
                            {
                                Key = EmailAddressKeyType.EmailAddress1,
                                Value = "mail1@example.com"
                            },
                        newEmailAddressDictionaryEntryType
                            {
                                Key = EmailAddressKeyType.EmailAddress1,
                                Value = "mail2@example.com"
                            }
                    };
    contact.EmailAddresses = emails.ToArray();
    Imaginedoingthis pre Framework 3.5
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    5
  • Anextendedproperty is a propertythatcanbe set onan item butwhich is notpresentedthrough the webservice out of the box. For instance the gender of a contact.
    In this case we wouldcreate a newExtendedproperty. The ExtendedFieldURI of thatproperty is a path to extended field type whichmaps to a propertythat is visible in outlook. The item willcontain the valuethat is to bedisplayed in the specified field.
    ExtendedPropertyTypegender =
    newExtendedPropertyType();
    gender.ExtendedFieldURI =
    newPathToExtendedFieldType();
    gender.ExtendedFieldURI.PropertyTag = "0x3a4d";
    gender.ExtendedFieldURI.PropertyType = MapiPropertyTypeType.Short;
    gender.Item = ((int)pGender).ToString();
    ExtendedProperties
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008
    6
  • 7
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008
  • Distribution List
    Youcan’tcreate a distribution list. The CreateItem web method does notallowyou to add a DistributionList.
    How do we workaroundthat ?
    Createan itemtype and addextendedproperties ‘tillitbecomes a distributionlist, and set the ItemClass to IPM.DistList
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    8
  • Adding the members
    WARNING:
    2 Extendedproperties:
    Member
    OneOffMember
    Both expect a BinaryArray.
    They are limited to 15000 bytes, (about 140 contact entries)
    Foreach entry in memberthere must bean entry in oneOffMember at the same index.
    BinaryArrayequals Base64String[]
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    9
  • Member
    A membercontains a link to contact through a hexed entry id.
    What we have is the ItemId and the ConvertId web method.
    ConvertIdTypeconvertReq = newConvertIdType();
    convertReq.DestinationFormat = IdFormatType.HexEntryId;
    convertReq.SourceIds = new[]
           {
               newAlternateIdType()
                   {
                       Format = IdFormatType.EntryId,
                       Mailbox = "administrator@litwareinc.com",
                       Id = item.ItemId.Id
                   }
           };
    ConvertIdResponseType response = esb.ConvertId(convertReq);
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    10
  • Member: the actual base 64 string
    The wrapped entry id is what we want in the base 64 string.
    Prefix of wrapped entry id =
    00000000C091ADD3519DCF11A4A900AA0047FAA4C300000000
    The response contains a stringwith bytes.
    We onlyneed part a of the retreivedstring.
    0003240033636237313064392D323134342D343761632D626137612D393730646364656335343664004600000000002F6E0D571298F14DA8E47B5FEDAA78A507001DD4ACE8303DD54F87DD53DA592670810001F3D7468A00000988B48B0E4D054284347C283576FD020424930B44BC0000
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    11
  • OneOffMember
    12
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008
    varretval = newList<byte>();
     
    varflags = Encoding.Unicode.GetBytes("");
    varversion = Encoding.Unicode.GetBytes("");
    var pad = Encoding.Unicode.GetBytes("");
    varmuid = newbyte[]
                      {
                          0x81, 0x2b, 0x1f, 0xa4, 0xbe,
                          0xa3, 0x10, 0x19, 0x9d, 0x6e,
                          0x00, 0xdd, 0x01, 0x0f, 0x54, 0x02
                      };
    varwFlags = newbyte[] { 0x01, 0x90 };
    varfirst = Encoding.Unicode.GetBytes(“contactname(email@d.com)”);
    varmiddle = Encoding.Unicode.GetBytes("UNKNOWN");
    var last = Encoding.Unicode.GetBytes(“email@d.com”);
     
    retval.AddRange(flags);
    retval.AddRange(muid);
    retval.AddRange(version);
    retval.AddRange(wFlags);
    retval.AddRange(first);
    retval.AddRange(pad);
    retval.AddRange(middle);
    retval.AddRange(pad);
    retval.AddRange(last);
    retval.AddRange(pad);
  • Resources
    http://msdn.microsoft.com/en-us/library/bb408417.aspx
    9 October, 2008
    Interacting with the Exchange Web Services,by Wim De Coninck
    13
  • 14
    Interacting with the Exchange Web Services,by Wim De Coninck
    9 October, 2008