Showing posts with label Outlook. Show all posts
Showing posts with label Outlook. Show all posts

Friday, April 23, 2010

Office 2010 RTM now available at TechNet Subscriber Downloads

Just a quick notice, I just reinstalled my X301 yesterday (Due to SSD slowdown) and was planning on using OWA until the RTM release of Office 2010 (I have enough Beta software on my machine as it is).

Turns out that I didn’t have to wait that long ;-)

Tuesday, October 13, 2009

Exchange Web Services Managed API Release Candidate – Part 2

Developing the every day Line Of Business Applications (LOBA) often includes handling various types of information. When dealing with custom CRM system you often need to collect and bind typed data sources together. One of these sources is often emails but of its good features i.e. handling unstructured information is also its worst. Fortunately the Exchange Server 2007 SP1 and EWS api provides us with tools and handles to enable us to structure and categorize all types of information in a Exchange Mailbox Store. When making connections between two systems some patterns always emerge. The first is you need an unique item key from the source system to store in the destination system to make a one way connection. This strategy has a flaw because when the source item is deleted you need to remove the reference key in the destination. In this case people tend to delete items though outlook and not your LOBA and outlook does not contact you LOBA to tell you have to delete the reference. So the before mentioned strategy flaw was the tight coupling of information between the source and destination.

So let me suggest another solution. Lets say you what to connect you LOBA with a item from a Exchange Mailbox. Instead of storing the Exchange Item ID in you LOBA try instead tag the Exchange Item with the item id from you LOBA you want to connect with. Then from the LOBA, search the Mailbox for items tagged with the LOBA item id. In this way when some elements has been deleted you do not end up with lost keys because the search will not return items that has been deleted. For making this work we need to handle to things: Item Extended Properties and the ability to search for these items.

Working with extended properties

To illustrate how to work with extended properties I will make use of an email object and store it in the default Innbox

   1: //Setup the request. es is an instance of ExchangeService



   2: EmailMessage em = new EmailMessage(es);



   3: em.Subject = "Hello World!";



   4: em.Body = "Your base belongs to us!";



   5: //Creating the Extended property CustomerID as a type of string



   6: ExtendedPropertyDefinition epd = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, "CustomerID", MapiPropertyType.String);



   7: //Give the property a value and assigning it to the email



   8: em.SetExtendedProperty(epd, "1234");



   9: // Store the message in the inbox



  10: em.Save(WellKnownFolderName.Inbox);




Searching form Extended Properties





   1: //Defining a view/windows into the search result.



   2: ItemView view = new ItemView(50);



   3: //Telling that i am only interested in the id of the item.



   4: view.PropertySet = new PropertySet(BasePropertySet.IdOnly);



   5: //Creating a extended property definition to search for.



   6: ExtendedPropertyDefinition epdCustomerID = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, "CustomerID", MapiPropertyType.String);



   7:  



   8: //Variable for storing the searchresult



   9: FindItemsResults<Item> foundItems;



  10:  



  11: do



  12: {   



  13:     //Search the inbox for at item with a extended property value stet to 1234



  14:     foundItems = es.FindItems(WellKnownFolderName.Inbox, new SearchFilter.IsEqualTo(epdCustomerID, "1234"), view);



  15:     foreach (Item current in foundItems)



  16:     {



  17:         //Getting the email message from the Exchange Service via the item id.



  18:         EmailMessage email = EmailMessage.Bind(es, current.Id) ;



  19:         Console.WriteLine("Message found. Subject: {0} - Body: {1}", email.Subject, email.Body);



  20:     }



  21:     //Offset the index of the view/windows with 50. This gives the ablity to page through larger resulset.



  22:     view.Offset += 50;



  23:     //while there more result available...



  24: } while (foundItems.MoreAvailable);




Other cool things



The item id can still be very valuable for your LOBA. If you store the id in you LOBA you can always find the item again even if a user decides to move the message to another folder. By using the EmailMessage.Bind method with the item id you will always get the message returned. Same thing goes for folders they also have a id. So even if the users decide to reorganize the folders with the folder id you can still find the folder again.

Tuesday, October 06, 2009

Exchange Web Services Managed API Release Candidate – Part 1

For some time now developers have been able to access Exchange Server 2007 via Exchange Web Services(EWS). To get this working you basically added a webreference in Visual Studio and constructed a request pending upon the type of function you wanted to execute. EWS was a great step away from the various message api(CDO, MAPI, WebDaV) which had their own strength and weakness. But still EWS can be laborious and you often end up building your own stub upon the EWS webreference. Through my teaching of Developing for Microsoft Unified Communications R2 i got to know a new API called Exchange Web Services Managed API. In short this is the way – this is the api for programming for Exchange Server 2007 with sp1. In the next few blogs I will run through some of the basics for this new API. As a first sending a email would be a place to start.

Sending email with EWS(c#)

   1: // Setup the request



   2: MessageType emailMessage = new MessageType();



   3:  



   4: // Set the To email address



   5: emailMessage.ToRecipients = new EmailAddressType[1];



   6: emailMessage.ToRecipients[0] = new EmailAddressType();



   7: emailMessage.ToRecipients[0].EmailAddress = "email@receiver.somewhere";



   8:  



   9: // Set the From email address



  10: emailMessage.From = new SingleRecipientType();



  11: emailMessage.From.Item = new EmailAddressType();



  12: emailMessage.From.Item.EmailAddress = "email@sender.somewhere";



  13:  



  14: // Set the Subject



  15: emailMessage.Subject = this.textBoxSubject.Text;



  16:  



  17: // Set the Body



  18: emailMessage.Body = new BodyType();



  19: emailMessage.Body.BodyType1 = BodyTypeType.Text;



  20: emailMessage.Body.Value = "Something to write about";



  21:  



  22:  



  23: // Create request object and set properties



  24:  



  25: // Create the CreateItemType in order to create and send the email



  26: CreateItemType request = new CreateItemType();



  27: request.Items = new NonEmptyArrayOfAllItemsType();



  28: request.Items.Items = new ItemType[1];



  29: request.Items.Items[0] = emailMessage;



  30: request.MessageDisposition = MessageDispositionType.SendAndSaveCopy;



  31: request.MessageDispositionSpecified = true;



  32:  



  33:  



  34: // Call CreateItem and process response



  35:  



  36: // Finally, call the CreateItem method to create and send the email



  37: CreateItemResponseType response = _service.CreateItem(request);



  38:  



  39: // Analyze the response message for success/failure



  40: ItemInfoResponseMessageType responseMessage = response.ResponseMessages.Items[0] as ItemInfoResponseMessageType;



  41:  



  42: if (responseMessage.ResponseClass == ResponseClassType.Success)



  43: success = true;



  44:  



  45: MessageBox.Show("Email send succeeded: " + success);




Sending email with EWS Managed API(c#)





   1: //Creating service binding for a Exchange Server 2007



   2: ExchangeService es = new ExchangeService(ExchangeVersion.Exchange2007_SP1);



   3:  



   4: //Assigning credentials for accessing the sender account



   5: es.Credentials = new System.Net.NetworkCredential("sender@email.somewhere", "SuperSecret#1");



   6:  



   7: //using autodiscover to find righ Exchange From End



   8: es.AutodiscoverUrl("pli@inceptio.dk");



   9:  



  10: //Creating a email message



  11: EmailMessage em = new EmailMessage(es);



  12: em.Subject = "Hello World!";



  13: em.Body = "Using EWS Managed API";



  14: em.ToRecipients.Add("receiver@emai.somewhere");



  15: em.SendAndSaveCopy();


Wednesday, April 29, 2009

Office 2007 Service Pack 2 released

It's finally out.

Get it here : http://www.microsoft.com/downloads/details.aspx?FamilyID=b444bf18-79ea-46c6-8a81-9db49b4ab6e5&displaylang=en

Lots of fixes - and Outlook in particular is much more responsive. Outlook-specific fixes and improvements detailed here: http://support.microsoft.com/kb/968774/

Happy downloading!

Sunday, August 24, 2008

Communicator Presence Controls in WPF

Last night I was preparing some ideas for a demo application I need later this week. The demo app had to look good and should be fun and interesting in the making. So I decided to code the UI in Windows Presentation Foundation (WPF). Code in XAML for WPF is simple and one will soon get the hang of it. So I went using some ListViews filled with data via LINQ to SQL and a data class. When I came to implementing Office Communicator 2007 functionality I realized that the “Microsoft Office Communicator 2007 Presence Controls” did only exists as Windows Forms User Controls and not as WPF user controls. Facing the choice of coding my own controls or try to make use of the existing Win Form controls I browsed around and found a XAML tag which enables you to host a windows forms control on a WPF page and the great part about it is really easy to use:

  1. Download the above mentioned controls from Microsoft and install them.
  2. Include the managed controls into you WPF project solution.
  3. Add the WindowsFromHost tag to the WPF XAML page.
  4. Add the necessary XML name spaces. Look for xmlns:q1 and xmlns:q2 in the example below
  5. Add the xml tag for persona list control - "q1:Personalist"
<Window x:Class="WPFHostingPresenceControls.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:q1="clr-namespace:Microsoft.Samples.Office.UnifiedCommunications.PresenceControls;assembly=PresenceControls"
xmlns:q2="clr-namespace:Microsoft.Samples.Office.UnifiedCommunications.PresenceBase;assembly=PresenceControls"
Title="Window1" Height="300" Width="300">
<Grid>
<WindowsFormsHost Name="windowsFormsHost1">
<q1:PersonaList x:Name="plMyPersonaList"/>
</WindowsFormsHost>
</Grid>
</Window>




Here after you can populate the list via code:




public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
plMyPersonaList.AddRange("pli@inceptio.dk", "someone@inceptio.dk");
}
}




and when you compile you should have something like this.



WPFHostingPrecenseControls

Tuesday, June 24, 2008

How do ISA figure out which authentication to use?

So you have published your Exchange server and your are using forms based authentication (FBA). But when you use Outlook Anywhere or ActiveSync (MSRPC), it bypasses FBA. Why does it do that and how does that work?

Well, thanks to my coworker Claus-Ole Olsen, I got the question answered. ISA uses the User-Agent header/string to decide whether it will actually use FBA or not! You can also select different forms based on the value - for different device capabilities.

The ISA GUI tells you it uses FBA, but you just cannot trust that as the User-Agent header will modify the rule!

Read it all here on TechNet Microsoft Internet Security and Acceleration Server 2006 Managing User-Agent Mappings, including scripts for viewing and setting the values.

If you want to avoid the VBScript, you can use PowerShell. This is Get-IsaUserAgentMapping.ps1 -

 

param([switch]$pretty)
$root=new-object -com fpc.root
$isaArray=$root.GetContainingArray()
$mappings=$isaarray.ruleelements.UserAgentMappings |
select PersistentName,UserAgent,Description,Enabled,@{n="FBAFormsType";e={
# For values, see http://technet.microsoft.com/en-us/library/bb794715.aspx
switch ($_.FBAFormsType) { 0 {"HTML 4.01"} 1 {"cHTML"} 2 {"XHTML-MP"} 3 {"Basic"} }
}},order
if ($pretty.isPresent) {
$mappings | Sort Order | Format-Table -auto UserAgent,Description,Enabled,FBAFormsType,Order
}
else {
$mappings
}

 


Adding and modifying is left as an exercise for yourself ;)

Thursday, December 13, 2007

Office 2007 SP1 fixes for Office Communicator/presence

These are from the Office SP1 Whitepaper

  • Microsoft Office Communicator 2007 now presents more accurate presence information and does so with consistent visual cues.
  • The icons used to display presence are modified so that users who are red-green colorblind can determine people’s presence status.
  • Office Communicator 2007 no longer causes presence icons to flicker when multiple people appear simultaneously.
  • Presence information in Office Communicator 2007 and other Microsoft Office applications is consistent in all scenarios (So this applies to SharePoint to).
  • Microsoft Office Outlook® 2007 no longer starts in the background along with Office Communicator 2007.
  • Office Outlook 2007 no longer allows users to send instant messages to entire distribution lists when deployed in conjunction with Microsoft Office Communicator 2007.

Following are the KB articles referenced in the SP1 xls file

  • KB936871 When you sign-in to Communicator, Outlook is started in the background. For example, when you check Task Manager, the Outlook.exe process is running. Additionally, Outlook-related items, such as meeting reminders, may appear.
  • KB936871 To check for a missed conversation, you click the "Voice Mail" search folder in Outlook 2007. Or, you click the "Missed Conversation" notification in Microsoft Office Communicator. If you then check for a missed conversation in the same session of Communicator, you receive a notification that states that Outlook could not be started.
  • KB937212 When a message is saved as a missed conversation in the Microsoft Office Communicator folder in Outlook 2007, the message indicator for the folder does not indicate a new, unread message.

Find SP1 on Microsoft Update or at the download site.

Monday, May 28, 2007

A PDF-Previewer for Outlook 2007

Looked for one. Found Ryan's PDF Preview Handler for Outlook/Vista. It works; is small and is only a very small wrapper around the Adobe Reader ActiveX. Using the original has the benefit that it can also handle PDFs that are password-protected. Great work, Ryan!