Created
November 10, 2009 21:52
-
-
Save zenchild/231311 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To link to OWA from an EWS item_id you must first convert the ID to something OWA will understand. You can do it using the following. After that, open the item like so: | |
# https://host/owa/?ae=Item&a=open&id=<converted item id> | |
$: << 'lib' | |
require 'viewpoint' | |
vp = Viewpoint::ExchWebServ.instance | |
vp.authenticate | |
vp.find_folders | |
msgs = vp.get_folder('Inbox').get_todays_messages | |
msg = msgs.last | |
altids_ar = NonEmptyArrayOfAlternateIdsType.new | |
altid_t = AlternateIdType.new | |
altid_t.xmlattr_Format = IdFormatType::EwsId | |
altid_t.xmlattr_Id = msg.item_id | |
altid_t.xmlattr_Mailbox = "[email protected]" | |
altids_ar.alternateId << altid_t | |
convertid_t = ConvertIdType.new(altids_ar) | |
convertid_t.xmlattr_DestinationFormat = IdFormatType::OwaId | |
resp = vp.ews.convertId(convertid_t) | |
owa_id = resp.responseMessages.convertIdResponseMessage.first.alternateId.xmlattr_Id | |
uri = "https://host/owa/?ae=Item&a=open&id=" + owa_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment