Le Café Central de DeVa              

                    let.us.develop.share.messaging.more... DeVa blogs!!




 

Blog - Title

February, 2009

  • Le Café Central de DeVa

    Outlook 2007 : Why i can’t accept an invitation that is in a third-party calendar format?

    • 1 Comments

    One of my customer updated that they have an application which uses Outlook Object Model which usually receives the invitation and process it. But when has issues for a specific invitation to a meeting in Microsoft Outlook 2007. This impacts him that he can’t no longer accept the invitation. When we researched regarding the issue, we found it’s not with respect to the code. We found that the invitation is generated and present in a third-party calendar format (ical).

    This issue is fixed in the Outlook 2007 post-Service Pack 1 Hotfix Package that was released on January 28, 2008.

  • Le Café Central de DeVa

    Outlook Object Model : Why i can’t able to assign value for MAPIFolder.WebViewURL ?

    • 1 Comments

    One of my customer had created an Outlook Add-in using VSTO & Outlook Object Model (OOM). As per the business logic, he need to implement the WebViewURL in it. The MAPIFolder.WebViewURL works fine and take’s us to set value to it most of the times, but it doesn’t function as expected in some time; the strange thing is it’s not throwing any error or exception when we execute the code.

    //[Code Snippet : C# , VSTO, Outlook Object Model (OOM)]
    ...
    //Provide the non-default store path
    String pstPath = @"providelocalpath like c:\personals.pst";
     
    MAPIFolder _pstFolder;
    //Add the PST
    this.Application.Session.AddStoreEx(pstPath, OlStoreType.olStoreDefault);
    _pstFolder = this.Application.Session.Folders[2];
     
    //Provide PSTFolder Name
    _pstFolder.Name = "SampleFolder";
     
    //Set the values
    MAPIFolder mf = _pstFolder.Folders.Add("MyHtmlView", Type.Missing);
     
    //Assign value for MAPIFolder.WebViewURL
    mf.WebViewURL = "http://www.microsoft.com";
    mf.WebViewOn = true;
    ...

    MAPIFolder.WebViewURL Property (Microsoft.Office.Interop.Outlook) Returns or sets a String (string in C#) indicating the URL of the Web page that is assigned to a folder. Read/write.
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mapifolder.webviewurl.aspx

    When we start troubleshooting the case, we found that the issue happens for the non-default stores.

    During research we found couple of community blog post references, Randy & Ryan’s MS Press book that with respect to Microsoft Office Outlook 2007, the home page setting is disabled for non-default stores. Non-default stores can include Personal Folders files (.pst) or the Microsoft Windows SharePoint Services folders. These folders are also stored in a .pst file. To see the home page setting for a non-default store, right-click the store in the Navigation Pane, click Properties, and then click the Home Page tab.

    By default, you cannot type or paste a URL in the Address box. This issue occurs because, by default, home pages are disabled for non-default stores. To overcome this issue, we don’t have any programmatic resolution; but we can implement the resolution by refer the following support KB.

  • Le Café Central de DeVa

    Part # 1 : Exchange Web Services (EWS) & VB.Net – Creating Calendar (non-Recurrence type)

    • 1 Comments

    Hi Peers,

    I have include the part 1 of Exchange Web Services & VB.Net. Earlier my couple of VB developer customers were looking for relevant VB.Net related articles and found very few. Keeping in that mind, i have created this EWS_VB.net_Calendar thread to start with.

    In this session we will going to see how we can create the Calendar using Exchange Web Services (EWS). I tried to provide things as simpler as i can…

    I would appreciate to know if you have any suggestions/clarifications regarding this…

     

    Step 1: Create Exchange Service Binding

    'Create Exchange Service Binding
    Dim esb As New ExchangeServiceBinding()
    'Provide the NetworkCredential
    esb.Credentials = New NetworkCredential("username", "password", "domain")
    'Provide the URL
    esb.Url = https://Fully qualified domain/ews/exchange.asmx


    Step 2: Create Calendar

    ' Create the appointment.
    Dim appointment As New CalendarItemType()


    Step 3: Set the properties of the appointment

    ' Set the properties of the appointment.
    appointment.Start = "2/24/2009 12:30:00PM"
    appointment.StartSpecified = True
    appointment.[End] = "2/24/2009 1:30:00PM"
    appointment.EndSpecified = True
    appointment.Subject = "Planning meeting by Deva"
    appointment.Location = "Building 3, Room 311"
    appointment.Body = New BodyType()
    appointment.Body.BodyType1 = BodyTypeType.Text
    appointment.Body.Value = "Plan the department party."

    Step 4: Add the required attendees

    ' Add required attendees.
    appointment.RequiredAttendees = New AttendeeType(1) {}
    appointment.RequiredAttendees(0) = New AttendeeType()
    appointment.RequiredAttendees(0).Mailbox = New EmailAddressType()
    appointment.RequiredAttendees(0).Mailbox.EmailAddress = "chris@contoso.com"

    Step 5: Create the array of items that will contain the appointment

    ' Create the array of items that will contain the appointment.
    Dim arrayOfItems As New NonEmptyArrayOfAllItemsType()
    arrayOfItems.Items = New ItemType(1) {}
     
    ' Add the appointment to the array of items.
    arrayOfItems.Items(0) = appointment
     
    ' Create the CreateItem request.
    Dim createRequest As New CreateItemType()
     
    'The SendMeetingInvitations attribute is required for calendar items.
    createRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy
    createRequest.SendMeetingInvitationsSpecified = True
     
    'Add the destination folder(calendar) to the CreateItem request.
    createRequest.SavedItemFolderId = New TargetFolderIdType()
    Dim dfCalendarFolder As DistinguishedFolderIdType = New DistinguishedFolderIdType()
    dfCalendarFolder.Id = DistinguishedFolderIdNameType.calendar
    createRequest.SavedItemFolderId.Item = dfCalendarFolder


    Step 6: Add the items to CreateItem request

    ' Add the items to the CreateItem request.
    createRequest.Items = arrayOfItems
     

    Step 7: Create the appointment by calling the CreateItem method & Check the result

    ' Create the appointment by calling the CreateItem method, which has the side effect of sending invitations to attendees.
    Dim createResponse As CreateItemResponseType = esb.CreateItem(createRequest)
     
    ' Check the result.
    If createResponse.ResponseMessages.Items(0).ResponseClass <> ResponseClassType.Success Then
         Throw New Exception("SendAppointment failed.")
    Else
                Console.WriteLine("Calendar Item Created")
    End If


    Step 8: Result

    image

  • Le Café Central de DeVa

    Gotcha - PermanentURL & WebDAV Series # 2 - How to access flat URLs using CDO/MAPI

    • 0 Comments

    With continuation to previous blog post, this article describes how to access items in a WebDAV application that are identified by using MAPI. The WebDAV application uses flat URLs to access items or folders.

    How to use flat URLs to access items by using MAPI ?

    1. Read property tag 0x670E001E by using MAPI on the folder or item to access.

    2. Save the returned value in a variable. The value will resemble the following:

      /-FlatUrlSpace-/ca09cf9efaad754e8a85909b04bb255c-12ee443

    3. Construct a URL that is used to access the folder or item that is using the flat URL. The URL will resemble the following:

      http://server/exchange/mailbox/-FlatUrlSpace-/ca09cf9efaad754e8a85909b04bb255c-12ee443

    4. Use the URL in a WebDAV call to access an item.

    Best use of Flat URL usage in the Programming

    Flat URLs do not have encoding and escaping rules and will work for folders and items in most DAV operations, with the following exceptions:

    • As destinations of MOVE or COPY operation
    • As a source for a DELETE
    • For Outlook Web Access URL commands; for example, ?cmd=[myCommand].

    Use this property when you are stepping out of CDO 1.2.1 or MAPI code into WebDAV. The HREF in WebDAV is usually created from the subject that was typed in Microsoft Outlook. The subject in Outlook can contain characters that are encoded for use with DAV. This encoding resembles URL encoding. Instead of reverse engineering the encoding, use the flat URL to get the item.

    Hope this helps.

  • Le Café Central de DeVa

    Unsupported Messaging API’s in Managed code – Outlook Add-ins

    • 1 Comments

    Certain technologies that predate the .NET Framework are not supported in managed code programming. These technologies include Collaboration Data Objects (CDO), Messaging Application Programming Interface (MAPI, often known as Extended MAPI), and Simple MAPI. These technologies were designed and developed with unmanaged code, and Microsoft does not provide official managed wrappers to support their use in managed applications. For more information, see the section "API's that are supported in managed code" in the article KB 266353: The support guidelines for client-side messaging development.

    If you want to know why the MAPI and CDO 1.21 is not supported in the managed .Net application, please refer Matt Stehle’s blogpost available: http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo-1-21-not-supported-in-managed-net-code.aspx.

    Nonetheless, Microsoft Office Outlook 2007 has offered many object model features that achieve what previously only CDO and Exchange Client Extensions (ECE) solved for developers. If you use CDO in an existing unmanaged Outlook application and the lack of support for CDO in managed solutions has hindered you from migrating the application to managed code, you can now consider updating your solution to managed code, using only the Outlook object model and the Primary Interop Assembly (PIA) for Outlook 2007, without having to resort to CDO.

  • Le Café Central de DeVa

    Outlook 2007 SP2’s application shutdown changes

    • 2 Comments

    I went through Ryan’s MSDN article, where we can learn how Microsoft Office Outlook 2007 Service Pack 2 has changed the way that the Outlook process shuts down. Customers developing Outlook solutions that run outside of the Outlook process should understand these changes and the impact on their solutions.

    Prior to Outlook 2007 SP2, Outlook followed the best practices for Component Object Model (COM) servers and allowed clients of the Outlook COM server to control the shutdown of the Outlook process. This caused a significant end-user side effect: often the end user could not close Outlook because of lingering external references from Outlook.

    As a result of customer feedback about the need to close Outlook and have Outlook stop running, Outlook 2007 SP 2 changes the way Outlook closes, ensuring that the intent of the end user─to close Outlook─is respected. These changes significantly affect the way that the Outlook COM server shuts down, which can impact solutions using the Outlook object model outside of the Outlook process.

    Impact for Add-ins

    If your solution is an in-process COM add-in, or if you used Microsoft Visual Studio Tools for Office to write an add-in for Outlook, this change does not affect the way that Outlook and your add-in work together. The lifetime of in-process add-ins and in-process COM references to Outlook objects in Outlook 2007 is the same as the lifetime of the Outlook process. When the user closes the last Outlook window and Outlook starts to close, Outlook disconnects add-ins and releases all of their references to Outlook.

    Add-ins can use the Quit event on the Application object to determine when Outlook closes down. After Outlook raises the Quit event, the OnDisconnection method of the IDTExtensibility2 interface of the add-in or the Shutdown method of the ThisAddin class of the Visual Studio Tools for Office add-in will be called, the add-in will be unloaded, and Outlook will close.

    Impact for Solutions

    In versions of Outlook earlier than Outlook 2007 SP2, before Outlook closed, Outlook would check for external, out-of-process references on its COM server and wait for those references to be released. This allowed out-of-process solutions that depended on Outlook data to keep Outlook running until the references were released. This is a common behavior for COM servers; however, this is unexpected behavior for end users, who expect that an application will close when they close the last window of the application.

    By default, Outlook 2007 SP2 ignores external COM references when determining if it should close. When an end user closes the last Outlook window on the user's computer, Outlook starts closing down the process: first raising the Quit event on the Application object, then disconnecting add-ins and external references, followed by flushing internal caches to disk, and finally exiting its process.

    Because of the way COM works, when Outlook releases external references, these referenced objects become disconnected objects in cross-process solutions. Without being aware that previously referenced objects have been disconnected by Outlook, a solution that attempts to use any of these object references will receive an error, RPC_E_DISCONNECTED. Solutions that are not designed to handle this error may stop responding or respond unexpectedly. This occurs when a solution attempts to use an object reference to Outlook after Outlook has closed and disconnected all previous references to the object.

    To work properly with the new behavior in Outlook, a solution should listen for the Quit event on the Application object. When that event is raised, the solution should stop any work in progress that uses Outlook data, and release all references to Outlook. Any remaining references after the solution returns from the Quit event will be disconnected. The solution should no longer use any of these disconnected references since any operation will result in an error. If the solution subsequently needs to access data from Outlook, it can request a new instance of the Application object by using the CoCreateInstance function, which will start Outlook without any user interface as described below. However, this should be avoided because the end user has closed Outlook.

    Note: The solution should be aware of the Windows shut-down events, and should not attempt to invoke a new instance of Outlook if Outlook is shutting down because Windows is shutting down.

    While a solution is handling the Quit event, Outlook can appear to have stopped responding to the end user and the operating system. The end user may forcibly terminate Outlook instead of waiting for it to finish closing. Therefore, the solution should handle and return from the Quit event as quickly as possible.

    As a result of this change, solutions may work differently on Outlook 2007 SP2. Solutions providers may need to update their solutions so that they work properly with the new behavior in Outlook 2007 SP2.

  • Le Café Central de DeVa

    Why Windows Vista based client prompts to enter your credentials when you access an FQDN site?

    • 1 Comments

    One of my customer reported that whenever he tries to use Web Distributed Authoring and Versioning (WebDav) to access a fully qualified domain names (FQDN) site. But he is prompted to enter the credentials, even though the user account that we are using has sufficient permission to access this site. During the research we found that he tries to access from a Windows Vista-based computer, where he do not configure a proxy in Windows Internet Explorer and he gets this issue/prompt.

    It’s because, in Windows Vista, Internet Explorer uses the Web Client service when you use Internet Explorer to access a WebDAV resource. The Web Client Service uses Windows HTTP Services (WinHTTP) to perform the network I/O to the remote host. WinHTTP sends user credentials only in response to requests that occur on a local intranet site. However, WinHTTP does not check the security zone settings in Internet Explorer to determine whether a Web site is in a zone that lets credentials be sent automatically.

    If no proxy is configured, WinHTTP sends credentials only to local intranet sites.

    Note If the URL contains no period in the server’s name, such as in the following example, the server is assumed to be on a local intranet site: http://sharepoint/davshare

    If the URL contains periods, the server is assumed to be on the Internet. The periods indicate that you use an FQDN address. Therefore, no credentials are automatically sent to this server unless a proxy is configured and unless this server is indicated for proxy bypass.

    Note A server can be indicated for proxy bypass either through the bypass list or through the proxy configuration script.

    In this case, you are prompted to enter your credentials when the Web site asks for credentials. Even in this case, the security zone settings are ignored.

    Hotfix available: To overcome this issue, a supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hot fix only to systems that are experiencing this specific problem.

    Important This hotfix is included in Windows Vista Service Pack 1 or a later service pack. However, you must still configure the AuthForwardServerList registry entry. For more information, see the Registry information section.

  • Le Café Central de DeVa

    How to assign service account access to all mailboxes in Exchange Server 2003?

    • 0 Comments

    Per the support KB which talks about how to grant permissions to all mailboxes. Granting access to all mailboxes can be useful when you are completing tasks such as offline recovery. As per the support KB, it’s recommended that not to use this procedure in a production environment to allow unauthorized access to user data. Doing so might violate your corporate privacy and security policies. Implement an auditing plan on your network to detect and to record improper use of network administrative credentials by system administrators.

    In Microsoft Exchange Server 5.5, when you grant Service Account Admin access rights on the Site container to a Microsoft Windows-based account, you grant that account unrestricted access to all mailboxes. In Microsoft Exchange 2000 Server and Exchange Server 2003, there is no service account, and even accounts with Enterprise Administrators rights are denied rights to gain access to all mailboxes.

    Note
    In Microsoft Windows 2000 Server and Microsoft Windows Server 2003, services typically run under the account of the computer where they are installed. This account is the local system account (LocalSystem), and its password is created and recycled by Windows 2000 or Windows Server 2003. By default, you can use this service account to gain access to the Exchange mailbox, the public folder stores, and other Windows resources for performing mail transfer and directory synchronization.

    If your logon account is the Administrator account or is a member of the Domain Admins or Enterprise Admins groups, then you are explicitly denied access to all mailboxes other than your own, even if you otherwise have full administrative rights over the Exchange system. All Exchange Server 2003 administrative tasks can be performed without having to grant an administrator sufficient rights to read other people's mail.

    You can override this default restriction in several ways, but do so only in accordance with your organization's security and privacy policies. Frequently, overriding the default restriction is appropriate only in a recovery server environment.

    How to grant the admin account access through ESM?

    To grant your administrative account access through Exchange System Manager to all mailboxes in a single database regardless of inherited denials:

    1. Start Exchange System Manager, and then locate the database you want to have full mailbox access to.
    2. Open the properties of this object, and then click the Security tab.
    3. Grant your account full explicit permissions on the object, including Receive As permissions.

    After you have made this change, you may still see unavailable Deny and Allow permissions assigned to your account. The unavailable permissions indicate that by inheritance you have been denied permission, but that you have inherited permissions at this level. In the Windows permissions model, explicitly granted permissions override inherited permissions.

    Note that an explicit Allow at a lower level permission overrides an explicit Deny from a higher level permission only on the single object where the override is set, not on that object's child objects. This prevents you from granting yourself permissions on a server to gain access to each database; you must grant permissions on databases individually.

    After you change permissions, you may have to log off and log back on. Microsoft also recommends that you stop and restart all Exchange services. If you have multiple domain controllers in the forest, you may also have to wait for directory replication to complete

  • Le Café Central de DeVa

    How to get Explorer & Inspector selected mail item using Outlook Object Model (OOM) & .Net?

    • 1 Comments

    In this article, we are going to see how we can get Explorer & Inspector selected mail item using Outlook Object Model (OOM) & .Net and process it.

    '[Code Snippet : VB.Net, .Net Framework 2.0/3.5, Outlook Object Model (OOM)]
    ...
               'Declaration part
                Dim ThisOutlookSession As Outlook.Application = New Outlook.Application
                Dim NS As Outlook.NameSpace = ThisOutlookSession.Session
                Dim objsel As Object
               'Check it's Inspector or Explorer Window
                If TypeName(ThisOutlookSession.ActiveWindow) = "Inspector" Then
                    MsgBox("Inspector")
                    objsel = ThisOutlookSession.ActiveInspector.CurrentItem
                    MsgBox(objsel.Subject)
                Else
                    MsgBox("Explorer")
                   'Get the selected item for processing
                    objsel = ThisOutlookSession.ActiveExplorer.Selection.Item(1)
                   'Check the relevant item and process per your logic
                    If (TypeOf objsel Is Outlook.MailItem) Then
                        Dim mailItem As Outlook.MailItem = _
                            TryCast(objsel, Outlook.MailItem)
                        MsgBox("Mail Item's Subject" & mailItem.Subject)
                        'Implement your business logic here
                        ...
                    ElseIf (TypeOf objsel Is Outlook.ContactItem) Then
                        Dim contactItem As Outlook.ContactItem = _
                           TryCast(objsel, Outlook.ContactItem)
                        MsgBox("Contact Item's Subject" & contactItem.Subject)
                        'Implement your business logic here
                        ...
                    ElseIf (TypeOf objsel Is Outlook. _
                    AppointmentItem) Then
                        Dim apptItem As Outlook.AppointmentItem = _
                           TryCast(objsel, Outlook.AppointmentItem)
                        MsgBox("Appointment Item's Subject" & apptItem.Subject)
                        'Implement your business logic here
                        ...
                    ElseIf (TypeOf objsel Is Outlook.TaskItem) Then
                        Dim taskItem As Outlook.TaskItem = _
                            TryCast(objsel, Outlook.TaskItem)
                        MsgBox("Task Item's Body" & taskItem.Body)
                        'Implement your business logic here
                        ...
                    ElseIf (TypeOf objsel Is Outlook.MeetingItem) Then
                        Dim meetingItem As Outlook.MeetingItem = _
                            TryCast(objsel, Outlook.MeetingItem)
                        MsgBox("Meeting Item's subject" & meetingItem.Subject)
                        'Implement your business logic here
                        ...
                    End If
                End If
                'Release the unwanted objects
                objsel = Nothing
    ...


    Applicable environment: Outlook 2007, Outlook Object Model, VB.Net, .Net Framework 2.0/3.5

  • Le Café Central de DeVa

    CDONTS, CDOSYS, System.Web.Mail & System.Net.Mail

    • 0 Comments

    Microsoft Windows Server 2003 does not install Collaboration Data Objects (CDO) for NTS (CDONTS). Therefore, applications that use CDONTS do not function on a Windows Server 2003-based computer.

    Windows Server 2003 provides improved alternatives to CDONTS. To make applications that use CDONTS function on a Windows Server 2003-based computer, update existing CDONTS applications to use one of the following technologies:

    • CDO for Windows 2000
      CDO for Windows 2000 provides a broader functionality set than CDONTS. This functionality includes the ability to send messages through a remote Simple Mail Transfer Protocol (SMTP) server. You can use CDO for Windows 2000 (CDOSYS) in applications that are not Microsoft .NET Framework-based.

      For example, Microsoft Visual Basic 6.0 and Microsoft ASP are not based in the .NET Framework. You can also use CDOSYS in .NET Framework applications.
    • System.Web.Mail
      The System.Web.Mail namespace provides a managed wrapper for CDOSYS. The System.Web.Mail namespace is only available in .NET Framework applications.
    • System.Net.Mail
      When we talk about .Net framework, we can use the System.Net.Mail namespace. It provides way to send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery.

    FYI: System.Net.Mail Vs System.Web.Mail

    In .NET 1.1, only the System.Web.Mail was available. This implementation needs to be done in quite different way. For example, attachment could only be added from files, not from Streams. So, this can be still used under .Net Framework 1.0 and 1.1, but going forward it’s “deprecated” or “Obsolete”; so it’s recommended that to make use of System.Net.Mail.

    The .NET 2.0 implementation is System.Net.Mail and is much more flexible and has a richer feature set.

Page 1 of 2 (20 items) 12