Blog - Title

December, 2009

Brijs Blogging... Looking Beyond the Obvious

  • Brijs Blogging... Looking Beyond the Obvious

    Issue: Getting HTTP 404 error on every request made via Exchange Web Services using EWS HTTP endpoint for Exchange Server 2010


    Few of our customer reported that they are getting HTTP 404 Error reported; when they tries to use EWS HTTP service endpoint for their application for Exchange Server 2010. However, the same application work fine with EWS HTTP service endpoint with Exchange Server 2007 without any issue.

    If we go into Internet Information Services (IIS) on Exchange 2010 RTM and uncheck the box 'Require secure channel (SSL)' on the EWS virtual directory. And then we attempt to make a request using HTTP using EWS service endpoint as “http://host:port/EWS/Exchange.asmx” then we would receive a HTTP 404 Resource Not Found.

    Exchange 2010 Web Services are now based on Windows Communication Foundation (WCF). We receive a HTTP 404 because WCF attempts to locate the endpoint for HTTP but cannot find it and throws a System.ServiceModel.EndpointNotFoundException exception which throws up to the client as a 404 exception.

    Using HTTP instead of HTTPS is not the recommended approach for Exchange Web Services but sometimes it is helpful in debugging/troubleshooting to have this option.

    Here are the steps posted by my colleague Dave @ How to configure a HTTP endpoint for Exchange Web Services in Exchange 2010 to workaround the issue.

  • Brijs Blogging... Looking Beyond the Obvious

    How to delete old items from .pst attached to Outlook using CDO1.21 programmatically?


    If you would like to clear up some old items from the growing PST attached to you Outlook profile; then here is a sample VBA macro code snippet to accomplish the job using CDO 1.21.

    NOTE: Following programming examples is for illustration only, without warranty either 'expressed or implied, including, but not limited to, the implied warranties of 'merchantability and/or fitness for a particular purpose. This sample code assumes that you 'are familiar with the programming language being demonstrated and the tools used to create 'and debug procedures. This sample code is provided for the purpose of illustration only 'and is not intended to be used in a production environment.

    'We need to add reference to Collaboration Data Objects, version 1.2.1 before running the VBA macro
    Sub RemoveAllOldItems()
        Dim ol As Outlook.Application
        Dim olns As Outlook.NameSpace
        Dim colStores As Outlook.Stores
        Dim oStore As Outlook.Store
        Dim oRoot As Outlook.Folder
        Dim ocal As Outlook.Folder
        Set ol = Application
        Set olns = ol.GetNamespace("MAPI")
        Set colStores = olns.Application.Session.Stores
         For Each oStore In colStores
            Set oRoot = oStore.GetRootFolder
            If oStore.ExchangeStoreType = 3 Then 'And oRoot = "Test" Then
                DeleteOldItems oRoot
                EnumerateFolders oRoot
            End If
    End Sub
    Public Function EnumerateFolders(ByVal objFld As Outlook.Folder)
        Dim folders As Outlook.folders
        Dim Folder As Outlook.Folder
        Dim foldercount As Integer
        Set folders = objFld.folders
        foldercount = folders.Count
        'Check if there are any folders below oFolder
        If foldercount Then
            For Each Folder In folders
                Debug.Print (Folder.FolderPath)
                DeleteOldItems Folder
                EnumerateFolders Folder
        End If
    End Function
    Public Function DeleteOldItems(ByVal objfl As Outlook.Folder)
        Dim oItems As Outlook.items
        Dim i As Long
        Set oItems = objfl.items
        Dim oRT As Date
        For i = oItems.Count To 1 Step -1
            oRT = oItems.Item(i).ReceivedTime
            'Checking for 4 months old items 
            If DateDiff("m", oRT, Now()) >= 4 Then
                Debug.Print "Old item found"
                'Uncomment the below line to delete this item
            End If
    End Function


    If you are running Outlook 2007 then you need to download and install CDO 1.21 @ Collaboration Data Objects, version 1.2.1

    Hope this helps! Happy Holidays :)

Page 1 of 1 (2 items)