Blog - Title

Brijs Blogging... Looking Beyond the Obvious

  • Brijs Blogging... Looking Beyond the Obvious

    Delegate Access and Delegate Access Management with Exchange Web Services.

    • 1 Comments

    One of the common request from our customers is to provide interface to work programmatically with Delegate Settings for Outlook.

    Microsoft Exchange Server 2007 Service Pack 1 (SP1) introduces delegate access and delegate access management through Exchange Web Services. The following delegate access functionality is available starting with Exchange 2007 SP1:

    • Delegates can access the mailbox of a principal and perform search, create, delete, update, and copy operations.
    • You can enable delegate access to items based on folder-level permissions that are set by using the delegate management operations.
    • Delegates can create and send meeting messages on behalf of the principal.
    • Delegates can receive meeting messages that are forwarded by the principal and respond to them for the principal.
    • Users who have owner rights on a shared mailbox can open the mailbox and act as the owner.
    • Delegates can create notification subscriptions on folders in the mailbox of the principal.

    Here are the few links related to it:

    And if you would like to do it with ease then try out Exchange Web Services Managed API Beta

    And if you would like to do deep dive about how delegate access works with Outlook then explore it:

    So, there is lot to explore in the Messaging World… Feel free to drop me your question related to Microsoft Messaging APIs

  • Brijs Blogging... Looking Beyond the Obvious

    List delegates of the Outlook Mailbox using CDO 1.2.1 via VBScript

    • 1 Comments

    I have recently worked out a VBScript to list delegate of the Outlook Mailbox using CDO 1.2.1 via VBScript and thought of share it with you all, here is the sample code:

    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.

     
    Dim objSession 
    Dim strProfileInfo 
    Dim strServer 
    Dim strMailbox 
    Dim objFolder
    Dim objMessages
    Dim objMessage
    Dim oFields
    Dim oField1
    Dim oField2
    Dim oFBFolder
     
    'TODO:Change Server and Mailbox info
    strServer="Server"
    strMailbox="User"
     
    strProfileInfo = strServer & vbLf & strMailbox
     
    Set objSession = CreateObject("MAPI.Session")
    objSession.Logon , , False, False, , True, strProfileInfo
     
    writelog( "Mailbox")
            
        writelog( "  ==> ")
        writelog( objSession.CurrentUser)
        writelog( vbCrLf)
    Msgbox "Logged On!!!"
     
    ' Reference the root folder by passing ID of ""
    Set oRoot = objSession.GetFolder("")
     
    'Connect to the Freebusy folder
    Set oFBFolder = oRoot.Folders.Item("Freebusy Data")
        Set objMessages = oFBFolder.Messages
     
        For Each objMessage In objMessages
     
            If objMessage.subject = "LocalFreebusy" Then
                'Get the message fields
     
                Set oFields = objMessage.Fields
                
                On Error Resume Next
     
        For i = 0 to UBound(oFields.Item(&H6844101E).Value(0))
      
                    Set oField1 = oFields.Item(&H6844101E)  ' PR_SCHDINFO_DELEGATE_NAMES
                           writelog "DELEGATE NAMES  ==> " & oField1.Value(0)(i)
                        writelog( vbCrLf)
     
                              Set oField2 = oFields.Item(&H686B1003) ' PR_DELEGATE_FLAGS
                  writelog "Delegate can see private  ==> " & oField2.Value(0)(i)
                              writelog( vbCrLf)
           Next
        End iF
    Next
     
    objSession.Logoff
     
    Set objSession =Nothing
     
    Set oField1 = Nothing
    Set oField2 = Nothing
    Set oFBFolder = Nothing
    Set oRoot = Nothing
     
    Msgbox "Done!!!"
     
    Sub WriteLog(ByVal strMessage)
        Dim fs
        Set fs = CreateObject("Scripting.FileSystemObject")
        Dim file
        Dim sScriptPath
        sScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
        Set file = fs.opentextfile(sScriptPath & "DelegateListLog.txt", 8, True)
        file.Write strMessage
        file.Close
    End Sub

    Please refer to the following MAPI properties used in the above sample to list delegates of the mailbox:

    If you interested in exploring further details regarding how delegate settings works in Outlook then refer to:

    However, if you just targeting Exchange Server 2007, I would highly recommend you to use EWS(Exchange Web Services)

    Delegate Access and Delegate Access Management with Exchange Web Services

  • Brijs Blogging... Looking Beyond the Obvious

    Download for Office 2007 SP2 is available now

    • 1 Comments

    Office 2007 SP2 is available for download

    The 2007 Microsoft Office Suite Service Pack 2 (SP2) provides customers with the latest updates to the 2007 Office suite (the products that are affected by this update are listed below). This download includes two types of fixes:

    • Previously unreleased fixes that were made specifically for this service pack.
      • In addition to general product fixes, this includes improvements in stability, performance, and security.
      • You can find out more information in Knowledge Base Article 953195, where product-specific changes are described.
    • All of the Public Updates, Security Updates, Cumulative Updates, and Hotfixes released through February 2009.

    Before installing this service pack, you are strongly encouraged to read 953195, which describes some big improvements introduced by SP2, and also calls out some important information that you should be aware of before installing.

    For the Outlook 2007 Specific changes in SP2 please refer to the Outlook 2007 improvements in the 2007 Office suite Service Pack 2 article.

    You can also download a workbook that contains a list of issues that are fixed by this service pack from the link mentioned below:

    Download the 2007 Office Service Pack 2 Changes.xlsx package

    Please let us know if you face any Outlook development related issues after upgrading to Office 2007 SP2.

  • Brijs Blogging... Looking Beyond the Obvious

    How to do FindFolder and MoveItem Operations of Exchange Web Services using VB.net

    • 1 Comments

    In continuations of my previous post How to do FindItem and GetItem Operations of Exchange Web Services using VB.net ; Here is the Exchange Web Services sample in VB.net to perform following task:

    • FindFolder(How to perform FindFolder Operation to get FolderId of specific folder for the root of the mailbox)
    • MoveItem (How to perform MoveItem Operation to move an item to the another folder within the mailbox)

    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. 

    Private Sub cmdMove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMove.Click
            Try
                If lstMails.SelectedItems.Count = 1 Then
                    Dim itemID As New ItemIdType
                    itemID.Id = lstMails.SelectedItems(0).SubItems(3).Text
     
                    'Find the folderId to which we want to move item
                    Dim parentFolder As New DistinguishedFolderIdType
                    parentFolder.Id = DistinguishedFolderIdNameType.root
                    Dim tfTargetFolder As New FolderIdType
                    'Change the name of the folder we are searching for FolderID
                    tfTargetFolder = FindFolder(ServiceBinding, parentFolder, "Test")
     
                    Dim newItemID As New ItemIdType
                    'Move am Item based on ItemId and FolderID
                    newItemID = MoveItemtoTest(ServiceBinding, itemID.Id, tfTargetFolder)
                    Dim strId As String
                    strId = "New ItemID " + newItemID.Id.ToString
                    MessageBox.Show(strId, "Item Moved", MessageBoxButtons.OK, MessageBoxIcon.Information)
                Else
                    MessageBox.Show("Please select a item in list to move", "Item to Move", MessageBoxButtons.OK, MessageBoxIcon.Information)
                End If
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
     
    Public Shared Function FindFolder(ByVal serviceBinding As ExchangeServiceBinding, ByVal fiFolderID As DistinguishedFolderIdType, ByVal fnFldName As String) As FolderIdType
     
            Dim rvFolderID As New FolderIdType
            ' Create the request and specify the travesal type
            Dim findFolderRequest As FindFolderType = New FindFolderType()
            findFolderRequest.Traversal = FolderQueryTraversalType.Deep
     
            ' Define the properties returned in the response
            Dim responseShape As FolderResponseShapeType = New FolderResponseShapeType()
            responseShape.BaseShape = DefaultShapeNamesType.Default
            findFolderRequest.FolderShape = responseShape
     
            ' Identify which folders to search
            Dim folderIDArray() As DistinguishedFolderIdType = New DistinguishedFolderIdType(1) {}
            folderIDArray(0) = New DistinguishedFolderIdType()
            folderIDArray(0).Id = fiFolderID.Id
     
            'Add Restriction for DisplayName
            Dim ffRestriction As New RestrictionType
            Dim ieToType As New IsEqualToType
            Dim diDisplayName As New PathToUnindexedFieldType
            diDisplayName.FieldURI = UnindexedFieldURIType.folderDisplayName
     
            Dim ciConstantType As New FieldURIOrConstantType
            Dim cvConstantValueType As New ConstantValueType
            cvConstantValueType.Value = fnFldName
            ciConstantType.Item = cvConstantValueType
            ieToType.Item = diDisplayName
            ieToType.FieldURIOrConstant = ciConstantType
            ffRestriction.Item = ieToType
            findFolderRequest.Restriction = ffRestriction
     
            ' Add the folders to search to the request
            findFolderRequest.ParentFolderIds = folderIDArray
     
            Try
                ' Send the request and get the response
                Dim findFolderResponse As FindFolderResponseType = serviceBinding.FindFolder(findFolderRequest)
                ' Get the response messages
                If findFolderResponse.ResponseMessages.Items(0).ResponseClass = ResponseClassType.Error Then
                    MessageBox.Show("Error Occured")
                    MessageBox.Show(findFolderResponse.ResponseMessages.Items(0).MessageText)
                    Return Nothing
                Else
                    Dim rmta() As ResponseMessageType = findFolderResponse.ResponseMessages.Items
                    Dim rmt As ResponseMessageType
                    For Each rmt In rmta
                        ' Cast to the correct response message type
                        Dim ffResponse As FindFolderResponseMessageType = rmt
                        Dim fFoundFolder As FolderType
                        For Each fFoundFolder In ffResponse.RootFolder.Folders
                            rvFolderID = fFoundFolder.FolderId
                            'MessageBox.Show(fFoundFolder.DisplayName)
                        Next
                    Next
                    'Return the FolderID of the last folder found
                    Return (rvFolderID)
                End If
            Catch e As Exception
                MessageBox.Show(e.Message)
                Return Nothing
            End Try
        End Function
    Public Shared Function MoveItemtoTest(ByVal serviceBinding As ExchangeServiceBinding, ByVal itemID As String, ByVal trgfldID As FolderIdType) As ItemIdType
     
            'Setup FolderId and ItemId to be passed to MoveItem
            Dim tfTargetFolder As TargetFolderIdType = New TargetFolderIdType()
            tfTargetFolder.Item = trgfldID
     
            Dim iiItemId As ItemIdType = New ItemIdType()
            iiItemId.Id = itemID
     
            'Create request to move Item and specify properties
            Dim miMoveItemRequest As MoveItemType = New MoveItemType()
            miMoveItemRequest.ItemIds = New ItemIdType(1) {}
            miMoveItemRequest.ItemIds(0) = iiItemId
            miMoveItemRequest.ToFolderId = tfTargetFolder
     
            Dim nID As New ItemIdType
            Try
                ' Send the request and get the response
                Dim miResponse As MoveItemResponseType = serviceBinding.MoveItem(miMoveItemRequest)
                If miResponse.ResponseMessages.Items(0).ResponseClass = ResponseClassType.Error Then
                    MessageBox.Show("Error Occured")
                    MessageBox.Show(miResponse.ResponseMessages.Items(0).MessageText)
                    Return Nothing
                Else
                    Dim iirmt As ItemInfoResponseMessageType = miResponse.ResponseMessages.Items(0)
                    If iirmt.Items.Items.Length > 0 Then
                        'Get updated ItemId from the Response Message
                        nID = iirmt.Items.Items(0).ItemId
                        MessageBox.Show("Item Moved")
                        'Return updated ItemID
                        Return nID
                    Else
                        Return Nothing
                    End If
                End If
            Catch e As Exception
                MessageBox.Show(e.Message)
                Return Nothing
            End Try
        End Function

    We can refer to the following articles related to the EWS:

    While we can workout more with Exchange Web Service auto generated proxies but don’t forget to have look at Microsoft Exchange Web Services (EWS) Managed API 1.0 to do stuff with less sweat. :)

  • Brijs Blogging... Looking Beyond the Obvious

    How to send Excel contents as PDF attachment with the email using CDOSYS

    • 2 Comments

    One of my customer would like to send Excel 2007 worksheet contents as email using CDOSYS. We are facing issues regarding formatting of the contents in the resultant emails on the different email clients. Then we decided to send contents as PDF attachment to avoid such issues.

    Here is the sample code VBA snippet used:

    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.

    Sub SendMail()
    Dim filepath As String
    filepath = "\\server\test\Excel 2007 Chart.pdf" 'TODO:change filepath for the temp pdf file
     'Exporting range of the excel contents which need to sent out
        Range("A1:I22").Select
        Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            filepath, _
            Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
     'Setting up CDOSYS configuration to send out the email 
    Set iMsg = CreateObject("CDO.Message")
        Set iConf = CreateObject("CDO.Configuration")
        Set Flds = iConf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'send via port
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ServerName" 'TODO:update the SMTP server name here
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Update
        End With
     
        With iMsg
            Set .Configuration = iConf
            .From = "xyz@domain.com" 'TODO:change email address here
            .To = "abc@domain.com" 'TODO:change email address here
            
            .Subject = "Test message with PDF Attachment"
            .HTMLBody = "Please find the attache excel pdf contents report"
            .AddAttachment (filepath)
            .Send
        End With
     
        Set iMsg = Nothing
        Set iConf = Nothing
    End Sub
     

    Hope this helps.

     

    Please feel free to write me if you have question related to Microsoft Messaging APIs.

  • Brijs Blogging... Looking Beyond the Obvious

    FYI: Microsoft Unveils Exchange 2010 with Public Beta

    • 1 Comments

    I am exited to share that the public beta of Microsoft Exchange Server 2010 is now available. Exchange 2010 is the first server in a new generation of Microsoft server technology designed and developed to work on-premises and as an online service, and introduces a new integrated e-mail archive and features to reduce costs and improve the user experience.

    For more details visit @ Exchange 2010 or Exchange Team Blog and don’t forget to have glance at new Exchange 2010 features and functionality in action.

  • Brijs Blogging... Looking Beyond the Obvious

    FYI: Exchange Web Services now got Managed Interface

    • 3 Comments

    If you are doing devolvement for Exchange Server 2007 using Exchange Web Services(EWS) then here’s news for you:

    The Microsoft Exchange Web Services (EWS) Managed API 1.0 Beta is available to download @ Exchange Web Services Managed API Beta

    The Microsoft Exchange Web Services (EWS) Managed API 1.0 Beta provides a managed interface for developing client applications that use Exchange Web Services. The EWS Managed API simplifies the implementation of applications that communicate with Microsoft Exchange Server 2007 Service Pack 1 (SP1) and later versions of Microsoft Exchange. Built on the Exchange Web Services SOAP protocol and Autodiscover, the EWS Managed API provides a .NET interface to EWS that is easy to learn, use, and maintain.

    If you would like to know more about EWS Managed API then have look @ Exchange Web Services Managed API video.

    You can also refer to Introducing the Exchange Web Services Managed API 1.0  and Microsoft Exchange Web Services Managed API 1.0 Beta SDK April 2009 which contains:

  • Introduction to the EWS Managed API
  • EWS Managed API Concepts
  • Working with the EWS Managed API
  • EWS Managed API Reference
  • We encourage you to download Exchange Web Services Managed API and use it for Exchange Server 2007 related development.

  • Brijs Blogging... Looking Beyond the Obvious

    FYI: Test your VBA coding skills and win!

    • 1 Comments
    Here is a news for you… MSDN® is sponsoring a coding contest for Office 2007, named OfficePalooza! This international contest will run for two weeks beginning April 20, 2009, and features ten fun Visual Basic of Applications™ (VBA) coding challenges in the form of puzzles and games. Each entrant will earn a chance to win one of hundreds of available prizes, determined by a random drawing at the end of the contest.

    In conjunction with this contest, an Advanced Business User theme will run on Microsoft Office Online from mid-April to mid-May, and will showcase the automation and extensibility aspects of Office 2007 through macros, custom VBA coding, the Fluent UI, and Office Open XML.  This collaborative effort will also highlight existing and newly-created content on the MSDN Microsoft Office Developer Center.

    “One important goal of this outreach effort is to familiarize the advanced business user with the incredible depth, breadth, and variety of content that can help them expand their knowledge and skills.” notes Eric White, Technical Evangelist in the Developer and Platform Evangelism Group for Microsoft Office. “There are articles, multimedia demos and webcasts, advice columns, forums, downloads and more. This content is designed to increase the user’s efficiency and effectiveness with Office 2007, and covers a spectrum including the beginner macro creator, the experienced VBA coder, and even the professional software developer. This effort also highlights some of the new capabilities and features of the 2007 Office System, such as the Office Fluent UI and the Office Open XML file formats.”

    Happy Coding!

  • Brijs Blogging... Looking Beyond the Obvious

    Unable to use Outlook Custom form with MSFlexGrid control

    • 1 Comments

    One of our customer reported that they are not able to use Outlook Custom form with MSFlxGrd control after recent security update installation.

    When they try to open or design the form they are getting “To help prevent malicious code from running, one or more objects in this form were not loaded. For more information, contact your administrator” error message.

    OLCF 

    This all started happening because of the security update that released in February 2009, KB960715 (Update Rollup for ActiveX Kill Bits),

    The challenge we face with the KB960715 update is that it kill-bitted certain commonly used VB controls including MSFlxGrd control.

    However, there is remedy to this problem. Since these are Visual Basic Controls, a VB cumulative update released in December 2008 did have new controls that replaced the kill-bitted controls.

    For a list of all the controls that were updated with this roll-up see, KB957924.

    In order to get a hold of these controls, you would need to have at least one development machine where you have the Visual Basic 6 IDE installed. You should then install the following updates on that machine:

    This will update your system with the new controls and to resolve the issue we need to register and use newer version of MSFlxGrd.ocx (file version 6.1.98.12) control.

    Please read the detail findings from The IE Support Team @ http://blogs.msdn.com/askie/archive/2009/02/20/certain-vb-controls-no-longer-display-on-web-pages-after-installing-kb960715.aspx. Shahinur BIG THANKS for the great work… which make life easier for me and others.

  • Brijs Blogging... Looking Beyond the Obvious

    How enumerate mailbox permission using ADSI VBScript?

    • 2 Comments

    We can use ADSI VBScript sample given below to enumerate mailbox permission from the exchange server.

    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.

    OPTION EXPLICIT
     
    Const ADS_ACETYPE_ACCESS_ALLOWED = &H00
    Const ADS_ACETYPE_ACCESS_DENIED = &H01
    Const ADS_ACETYPE_SYSTEM_AUDIT = &H02
    Const ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = &H05
    Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H06
    Const ADS_ACETYPE_SYSTEM_AUDIT_OBJECT = &H07
    Const ADS_ACETYPE_SYSTEM_ALARM_OBJECT = &H08
    Const ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK = &H09
    Const ADS_ACETYPE_ACCESS_DENIED_CALLBACK = &H0A
    Const ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK_OBJECT = &H0B
    Const ADS_ACETYPE_ACCESS_DENIED_CALLBACK_OBJECT = &H0C
    Const ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK = &H0D
    Const ADS_ACETYPE_SYSTEM_ALARM_CALLBACK = &H0E
    Const ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK_OBJECT = &H0F
    Const ADS_ACETYPE_SYSTEM_ALARM_CALLBACK_OBJECT = &H10
     
    Const ADS_ACEFLAG_INHERIT_ACE = &H02
    Const ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE = &H04
    Const ADS_ACEFLAG_INHERIT_ONLY_ACE = &H08
    Const ADS_ACEFLAG_INHERITED_ACE = &H10
    Const ADS_ACEFLAG_VALID_INHERIT_FLAGS = &H1f
    Const ADS_ACEFLAG_SUCCESSFUL_ACCESS = &H40
    Const ADS_ACEFLAG_FAILED_ACCESS = &H80
     
    Const ADS_RIGHT_DELETE = &H00010000
    Const ADS_RIGHT_READ_CONTROL = &H00020000
    Const ADS_RIGHT_WRITE_DAC = &H00040000
    Const ADS_RIGHT_WRITE_OWNER = &H00080000
    Const ADS_RIGHT_SYNCHRONIZE = &H00100000
    Const ADS_RIGHT_ACCESS_SYSTEM_SECURITY = &H01000000
    Const ADS_RIGHT_GENERIC_READ = &H80000000
    Const ADS_RIGHT_GENERIC_WRITE = &H40000000
    Const ADS_RIGHT_GENERIC_EXECUTE = &H20000000
    Const ADS_RIGHT_GENERIC_ALL = &H10000000
    Const ADS_RIGHT_DS_CREATE_CHILD = &H00000001
    Const ADS_RIGHT_DS_DELETE_CHILD = &H00000002
    Const ADS_RIGHT_ACTRL_DS_LIST = &H00000004
    Const ADS_RIGHT_DS_SELF = &H00000008
    Const ADS_RIGHT_DS_READ_PROP = &H00000010
    Const ADS_RIGHT_DS_WRITE_PROP = &H00000020
    Const ADS_RIGHT_DS_DELETE_TREE = &H00000040
    Const ADS_RIGHT_DS_LIST_OBJECT = &H00000080
    Const ADS_RIGHT_DS_CONTROL_ACCESS = &H00000100
     
    Const FULLCONTROL = 983551
     
    Const ReceiveAs = "{AB721A56-1E2F-11D0-9819-00AA0040529B}"
    Const SendAs = "{AB721A54-1E2F-11D0-9819-00AA0040529B}"
     
    Dim objUser
    Dim oSecurityDescriptor 
    Dim dacl 
    Dim ace 
    Dim strOutput
    Dim strPath
    Dim strOutputPath
    Dim fso
    Dim fOutput
    Dim strAccount 
    Dim strAccess
    Dim Conn
    Dim Comm
    Dim RSAll
    Dim iAdRootDSE
    Dim strNameingContext
    Dim Query
     
     
    strOutput = InputBox("File Output", "", "ExportData.csv")
     
    strPath = WScript.ScriptFullName
    stroutputPath = Left(strPath, InStrRev(strPath, "\"))
     
    set fso = CreateObject("Scripting.FileSystemObject")
    set fOutput = fso.CreateTextFile(strOutputPath & strOutput, 8)
     
     
    Set iAdRootDSE = GetObject("LDAP://RootDSE")
    strNameingContext = iAdRootDSE.Get("defaultNamingContext")
    Query = "<LDAP://" & strNameingContext & ">;(&(mailnickname=*)(objectCategory=person)(objectClass=user));samaccountname,displayname,distinguishedName;subtree"
     
     
    set conn = createobject("ADODB.Connection")
     
    Conn.Provider = "ADsDSOObject"
    Conn.Open "ADs Provider"
     
    set comm = createobject("ADODB.Command")
    Comm.ActiveConnection = conn
    Comm.CommandText = Query
    Comm.Properties("Page Size") = 1000
     
    Set RsAll = Comm.Execute
     
    Dim dn
    While Not RSAll.EOF
        dn = "LDAP://" & replace(RSAll.Fields("distinguishedName").Value,"/","\/")
        GetPermissions(dn)
        RSAll.movenext
    Wend
     
    WScript.Echo "Done viewing the security descriptor"
    WScript.Quit
        
     
    '====================================================================
    ' Get the msExchMailboxSecurityDescriptor attribute and break it down
    '====================================================================
    sub GetPermissions(DN)
     
    'Get directory user object.
    Set objUser = GetObject(DN)
    'Here we can use Display name as well to print.
    strAccount = objUser.Get("samAccountName")
    'strAccount = objUser.Get("displayName")
    fWriteLine("*Permission Info for :" & strAccount & vbcrlf) 
    Set oSecurityDescriptor = objUser.Get("msExchMailboxSecurityDescriptor")
     
    Set dacl = oSecurityDescriptor.DiscretionaryAcl
    Set ace = CreateObject("AccessControlEntry")
     
    For Each ace In dacl
    ' Display all the properties of the ACEs using the IADsAccessControlEntry interface.
     
    strAccess = "Access Mask: " & vbcrlf
     
    if (ace.AccessMask AND ADS_RIGHT_DELETE ) then strAccess = strAccess & " Delete Permission" & vbcrlf
    if (ace.AccessMask AND ADS_RIGHT_READ_CONTROL ) then strAccess = strAccess & " Read Permission " & vbcrlf
    if (ace.AccessMask AND ADS_RIGHT_WRITE_DAC ) then strAccess = strAccess & " Change Permission" & vbcrlf
    if (ace.AccessMask AND ADS_RIGHT_WRITE_OWNER ) then strAccess = strAccess & " Take Ownership " & vbcrlf
    if (ace.AccessMask AND ADS_RIGHT_ACTRL_DS_LIST ) then strAccess = strAccess & " Associated External Account" & vbcrlf
    if (ace.AccessMask AND ADS_RIGHT_DS_CREATE_CHILD ) then strAccess = strAccess & " Full Rights " & vbcrlf
     
    fWriteLine("*==========================================================================*")
    'fWriteLine("* RAW Info:" & vbcrlf & "TRUSTEE :" & vbcrlf & " " & ace.Trustee & vbcrlf & _
    '"AccessMask:" & vbcrlf & " " & ace.AccessMask & vbcrlf & _
    '"AceType :" & vbcrlf & " " & ace.AceType & vbcrlf & _
    '"AceFlags :" & vbcrlf & " " & ace.AceFlags & vbcrlf & _
    '"Flags :" & vbcrlf & " " & ace.Flags & vbcrlf & _
    '"ObjectType:" & vbcrlf & " " & ace.ObjectType & vbcrlf & _
    '"Inherited :" & vbcrlf & " " & ace.InheritedObjectType)
     
    'fWriteLine("*--------------------------------------------------------------------------*")
    fWriteLine("* Access Info:" & vbcrlf & "TRUSTEE :" & vbcrlf & " " & ace.Trustee & vbcrlf & strAccess)
    Next
     
     
    End Sub
     
     
    '====================================================================
    ' Write the data to a file
    '====================================================================
    sub fWriteLine(data)
    fOutput.WriteLine data
    end sub

    For a version of the above script which uses CDOEXM checkout my colleague's post @ http://blogs.msdn.com/vikas/archive/2008/11/01/howto-programmatically-enumerate-permissions-on-exchange-2003-mailbox-store.aspx
  • Brijs Blogging... Looking Beyond the Obvious

    How to do FindItem and GetItem Operations of Exchange Web Services using VB.net

    • 2 Comments

    It does seem to be a bit of a dearth of VB.net samples for Exchange Web Service. So here is a sample Vb.net code which demonstrates:

    • FindItem(How to perform FindItem Operation to list all items from the inbox folder of a use mailbox)
    • GetItem (How to perform GetItem Operation to get an item with all properties)

    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. 

    'List all the items from the inbox folder
     Private Function ListFolderItems(ByRef esb As ExchangeServiceBinding) As List(Of MessageType)
            Dim Messages As New List(Of MessageType)
            Messages = Nothing
     
            ' Form the FindItem request
            Dim findRequest As FindItemType = New FindItemType()
            findRequest.Traversal = ItemQueryTraversalType.Shallow
     
            ' Define which item properties are returned in the response
            Dim itemProperties As ItemResponseShapeType = New ItemResponseShapeType()
            itemProperties.BaseShape = DefaultShapeNamesType.AllProperties
     
            ' Add properties shape to request
            findRequest.ItemShape = itemProperties
     
            ' Identify which folders to search to find items
            Dim folderIDArray() As DistinguishedFolderIdType = New DistinguishedFolderIdType(1) {}
            folderIDArray(0) = New DistinguishedFolderIdType()
            folderIDArray(0).Id = DistinguishedFolderIdNameType.inbox
     
            ' Add folders to request
            findRequest.ParentFolderIds = folderIDArray
     
     
            'Send the listing (find) request and get the response
            Dim findResp As New FindItemResponseType
            findResp = esb.FindItem(findRequest)
     
            ' Get the response messages
            Dim responseMessage As ResponseMessageType
            For Each responseMessage In findResp.ResponseMessages.Items
                ' Cast to the correct response message type
                Dim findItemResponseMessage As FindItemResponseMessageType = responseMessage
                If findItemResponseMessage.ResponseClass = ResponseClassType.Success Then
     
                    ' Get the actual payload of items
                    Dim realItems As ArrayOfRealItemsType = findItemResponseMessage.RootFolder.Item
                    If Not realItems.Items Is Nothing Then
                        ' Initialize list of messages and fill
                        Messages = New List(Of MessageType)(realItems.Items.Length)
                        Dim message As MessageType = Nothing
                        Dim item As ItemType = Nothing
                        For Each item In realItems.Items
                            If TypeOf item Is MessageType Then
                                message = item
                                Messages.Add(message)
                            End If
                        Next
                    End If
                End If
            Next
            Return Messages
        End Function
     
    'To get a specific item based on ItemId
    Public Shared Function GetItem(ByVal serviceBinding As ExchangeServiceBinding, ByVal itemID As String) As ItemType
            ' Form the GetItem request
            Dim getRequest As GetItemType = New GetItemType()
     
            ' Define which item properties are returned in the response
            Dim itemProperties As ItemResponseShapeType = New ItemResponseShapeType()
            itemProperties.BaseShape = DefaultShapeNamesType.AllProperties
     
            ' Add properties shape to request
            getRequest.ItemShape = itemProperties
     
            ' Set the itemID of the desired item to retrieve
            Dim id As ItemIdType = New ItemIdType()
            id.Id = itemID
     
            getRequest.ItemIds = New ItemIdType() {id}
            ' Send the listing (find) request and get the response
            Dim getResp As New GetItemResponseType
            getResp = serviceBinding.GetItem(getRequest)
     
            ' Get the response message
            If getResp.ResponseMessages.Items(0).ResponseClass = ResponseClassType.Success Then
                Dim iirmt As ItemInfoResponseMessageType = getResp.ResponseMessages.Items(0)
                If iirmt.Items.Items.Length > 0 Then
                    Return iirmt.Items.Items(0)
                Else
                    Return Nothing
                End If
            Else
                Return Nothing
            End If
        End Function
     
     

    Here are the few link related to EWS for basis understanding :

    Please share you comments or questions with me related to subjects on my blog. I would like to explore the messaging world further with you...

  • Brijs Blogging... Looking Beyond the Obvious

    How to delete an attendee from Meeting Request using Exchange Web Services?

    • 1 Comments

    In order to remove attendees from an attendee collection, we have to call the UpdateItem Web method for the meeting with the SetItemField change description to include all current members of the attendee array minus those you want removed.

    Please refer to the sample code below which demonstrates:

    • CreateItem (How to create a meeting request)
    • GetItem (How to perform GetItem with additional properties)
    • UpdateItem (How to delete an attendee from the Meeting Request)

    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.

    using System;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.Net.Security;
    using EWSDeleteAnMeetingAttendee.EWSMsgEX07;
    using System.Security.Cryptography.X509Certificates;
     
    namespace EWSDeleteAnMeetingAttendee
    {
        class DeleteAttendee
        {
            private static ExchangeServiceBinding binding = null;
            private static string itemID = "";
            private static string email = "user@domain.com";
     
            static void Main(string[] args)
            {
                // Setup the binding with credentials and URL.
                DeleteAttendee prg = new DeleteAttendee();
     
                binding = new ExchangeServiceBinding();
                //Update UserName, Password, Domain, EWS URL
                binding.Credentials = new NetworkCredential("User", "Password", "domain.com");
                binding.Url = @"https://Server/EWS/Exchange.asmx";
     
                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
                {
                    // Replace this line with code to validate server certificate.
                    return true;
                };
     
                prg.CreateMeetingRequest();
                prg.DeleteMeetingAttendee(email);
            }
     
            public void CreateMeetingRequest()
            {
                //Migrating to Exchange Web Services, Part 2: Calendaring
                //http://msdn.microsoft.com/en-us/library/cc788131.aspx
                // Create the appointment.
                CalendarItemType appointment = new CalendarItemType();
     
                // Set the properties of the appointment.
                appointment.Start = new DateTime(2009, 01, 29, 8, 30, 0, DateTimeKind.Unspecified);
                appointment.StartSpecified = true;
                appointment.End = new DateTime(2009, 01, 29, 9, 30, 0, DateTimeKind.Unspecified);
                appointment.EndSpecified = true;
                appointment.Subject = "New Planning meeting";
                appointment.Location = "Building 007";
                appointment.Body = new BodyType();
                appointment.Body.BodyType1 = BodyTypeType.Text;
                appointment.Body.Value = "This is a Meeting Invite for discussion";
     
                // Add required attendees.
                appointment.RequiredAttendees = new AttendeeType[2];
                appointment.RequiredAttendees[0] = new AttendeeType();
                appointment.RequiredAttendees[0].Mailbox = new EmailAddressType();
                appointment.RequiredAttendees[0].Mailbox.EmailAddress = "User1@domain.com";
     
                appointment.RequiredAttendees[1] = new AttendeeType();
                appointment.RequiredAttendees[1].Mailbox = new EmailAddressType();
                appointment.RequiredAttendees[1].Mailbox.EmailAddress = "User2@domain.com";
     
                // Create the array of items that will contain the appointment.
                NonEmptyArrayOfAllItemsType arrayOfItems = new NonEmptyArrayOfAllItemsType();
                arrayOfItems.Items = new ItemType[1];
     
                // Add the appointment to the array of items.
                arrayOfItems.Items[0] = appointment;
     
                // Create the CreateItem request.
                CreateItemType createRequest = new CreateItemType();
     
                // The SendMeetingInvitations attribute is required for calendar items.
                createRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy;
                createRequest.SendMeetingInvitationsSpecified = true;
     
                // Add the destination folder to the CreateItem request.
                DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
                folder = new DistinguishedFolderIdType();
                folder.Id = DistinguishedFolderIdNameType.calendar;       
                createRequest.SavedItemFolderId = new TargetFolderIdType();
                createRequest.SavedItemFolderId.Item = folder ;
                
                // Add the items to the CreateItem request.
                createRequest.Items = arrayOfItems;
     
                // Create the appointment by calling the CreateItem method, which has
                // the side effect of sending invitations to attendees.
                CreateItemResponseType createResponse = binding.CreateItem(createRequest);
     
                // Check the result.
                if (createResponse.ResponseMessages.Items[0].ResponseClass !=  ResponseClassType.Success)
                {
                    throw new Exception("Create Meeting failed.");
                }
                
                ItemInfoResponseMessageType iirmt = ((ItemInfoResponseMessageType)createResponse.ResponseMessages.Items[0]);
                if (iirmt.ResponseClass == ResponseClassType.Success)
                {
                    ItemType it = (ItemType)iirmt.Items.Items[0];
                    itemID = it.ItemId.Id;
                }
            }
     
            static CalendarItemType  GetCalItem(string itemIDCal)
            {
                // Create the request.
                GetItemType request = new GetItemType();
     
                // Create the response shape.
                ItemResponseShapeType responseShape = new ItemResponseShapeType();
                responseShape.BodyType = BodyTypeResponseType.Text;
                responseShape.BodyTypeSpecified = true;
                responseShape.BaseShape = DefaultShapeNamesType.Default;
                // Add more properties to the request.
     
                PathToUnindexedFieldType[] attendees = new PathToUnindexedFieldType[1];
                attendees[0] = new PathToUnindexedFieldType();
                attendees[0].FieldURI = UnindexedFieldURIType.calendarRequiredAttendees;
                responseShape.AdditionalProperties = attendees;
                     
                // Add the response shape to the request.
                request.ItemShape = responseShape;
                
                // Identify the items to get.
                ItemIdType[] items = new ItemIdType[1];
                items[0] = new ItemIdType();
                items[0].Id = itemIDCal;
                           
                // Add items to the request.
                request.ItemIds = items;
     
                try
                {
                    // Send the request and get the response.
                    GetItemResponseType resp = binding.GetItem(request);
                    ArrayOfResponseMessagesType aormt = resp.ResponseMessages;
                    ResponseMessageType[] rmta = aormt.Items;
     
                    foreach (ResponseMessageType rmt in rmta)
                    {
                        ItemInfoResponseMessageType iirmt = (rmt as ItemInfoResponseMessageType);
                        ArrayOfRealItemsType aorit = iirmt.Items;
                        ItemType[] myItems = aorit.Items;
                        
                        if (myItems[0] is CalendarItemType)
                        {
                            CalendarItemType calendar = (myItems[0] as CalendarItemType);
                            return calendar;
                        }
                        else
                        {
                            // Check for other item types.
                            return null;
                        }
                    }
                    return null;
                }
                catch (Exception e)
                {
                    throw new Exception("GetItem failed");
                }
            }
     
            public void DeleteMeetingAttendee(string email)
            {
                CalendarItemType cal = GetCalItem(itemID); 
                CalendarItemType newcalendar = new CalendarItemType();
                newcalendar.RequiredAttendees = new AttendeeType[2];
                Int32 oi = 0;
                foreach (AttendeeType oattendee in cal.RequiredAttendees)
                {
                    if (oattendee.Mailbox.EmailAddress != email)
                    {
                        newcalendar.RequiredAttendees[oi] = new AttendeeType();
                        newcalendar.RequiredAttendees[oi].Mailbox = new EmailAddressType();
                        newcalendar.RequiredAttendees[oi].Mailbox.EmailAddress = oattendee.Mailbox.EmailAddress;
                        oi++;
                    }
                }
     
                // Create calendar items to contain each non-deletion update.
                // Add the calendar item and the identified set field to
                // the ItemChangeDescriptionType. This is a SetItemFieldType.
     
                PathToUnindexedFieldType att = new PathToUnindexedFieldType();
                att.FieldURI = UnindexedFieldURIType.calendarRequiredAttendees;
                
                SetItemFieldType set = new SetItemFieldType();
                set.Item = att;
                set.Item1 = newcalendar;
                           
                // Create the identifier of the item to update.
                ItemIdType itemId = new ItemIdType();
                itemId.Id = cal.ItemId.Id ;
                itemId.ChangeKey = cal.ItemId.ChangeKey  ;
     
                // Create and populate the request.
                UpdateItemType request = new UpdateItemType();
                request.ItemChanges = new ItemChangeType[1] { new ItemChangeType() };
                request.ItemChanges[0].Item = itemId;
                request.ItemChanges[0].Updates = new ItemChangeDescriptionType[1];
                request.ItemChanges[0].Updates[0] = set;
                
                request.ConflictResolution = ConflictResolutionType.AutoResolve;
                request.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToAllAndSaveCopy;
                request.SendMeetingInvitationsOrCancellationsSpecified = true;
     
                // Send the update request and receive the response.
                UpdateItemResponseType response = binding.UpdateItem(request);
                ArrayOfResponseMessagesType aormt = response.ResponseMessages;
                ResponseMessageType[] rmta = aormt.Items;
     
                foreach (ResponseMessageType rmt in rmta)
                {
                    ItemInfoResponseMessageType respMsg = (rmt as ItemInfoResponseMessageType);
                    foreach (ItemType item in respMsg.Items.Items)
                    {
                        Console.WriteLine("Item ID: " + item.ItemId.Id);
                        Console.WriteLine("New change key: " + item.ItemId.ChangeKey);
                        Console.ReadLine();
                    }
                }
            }
        }
    }
      

    Remember, If we try to use a DeleteItemField change description, we would remove all attendees from the collection. Any attendee who is removed from an attendee list as the result of an update will be sent a meeting cancellation (unless the SendMeetingInvitationsOrCancellations value was set to "SendToNone").

    Any attendee who has been removed from all attendee collections, but has not been sent a meeting cancellation, will still have a copy of the meeting on his calendar. The removed attendee may still register a response even after being removed from the attendee list. If that happens, the removed attendee will be re-added to the optional attendees collection on the meeting in the organizer's calendar.

    Best Practices
    As a general rule, we recommend you not to use the combination of a ConflictResolution value of 'AlwaysOverwrite' and a SendMeetingInvitationsOrCancellations value of 'SendToNone' in your calls to the UpdateItem Web method. The combination of these values will result in any removed attendees not receiving a meeting message indicating they have been removed.

    I also recommend you to refer to the following articles:

    EWS Rocks!

  • Brijs Blogging... Looking Beyond the Obvious

    How to read Internet Headers using WebDAV

    • 0 Comments

    We can get Internet Headers/Message Headers via WebDAV using PR_TRANSPORT_MESSAGE_HEADERS MAPI property.

    PidTagTransportMessageHeaders Canonical Property

    http://msdn.microsoft.com/en-us/library/cc815628.aspx

    PR_TRANSPORT_MESSAGE_HEADERS
    http://schemas.microsoft.com/mapi/proptag/0x007D001F

     

    Here is VBScript sample with WebDAV PROPFIND request.

    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.
     
    Dim objX, strR, strRes
    Set objX = CreateObject("Microsoft.XMLHTTP")
    'Change Item URL, Domain, User, Password
    objX.Open "PROPFIND", "http://server/exchange/user/Inbox/Item123.EML", FALSE, "Domain\User", "Password"
    strR = "<?xml version='1.0'?>"
    strR = strR & "<d:propfind xmlns:d='DAV:' xmlns:m='urn:schemas:mailheader:' "
    strR = strR & "xmlns:e='http://schemas.microsoft.com/exchange/' xmlns:p='http://schemas.microsoft.com/mapi/proptag/'> "
    strR = strR & "<d:prop><d:displayname/><p:0x007D001f/></d:prop></d:propfind>"
     
    objX.SetRequestHeader "Content-type:", "text/xml"
    objX.SetRequestHeader "Depth", "1"
    objx.SetRequestHeader "translate", "f"
    objX.send(strR)
     
    strRes = objX.responseText
    Msgbox strRes

     

    And following is sample WebDAV SELECT request.

    <?xml version="1.0"?>
    <D:searchrequest xmlns:D = "DAV:">
    <D:sql>SELECT "urn:schemas:mailheader:to", http://schemas.microsoft.com/mapi/proptag/0x007D001F, "urn:schemas:httpmail:subject" FROM "/exchange/user/Inbox/" 
    WHERE "DAV:ishidden" = false AND "DAV:isfolder" = false</D:sql>
    </D:searchrequest>

     

    Please also refer the article mentioned below related to supportability of working with MAPI properties

    The Support Guidelines for Client-Side Messaging Development
    http://support.microsoft.com/kb/266353
    Refer Section: Integrating with Outlook properties

  • Brijs Blogging... Looking Beyond the Obvious

    MAPI documentation got Revamped

    • 1 Comments

    If you are developer working on MAPI then here is the news:

    MAPI documentation is revamped and republished on MSDN  

    Welcome to the Outlook 2007 MAPI Reference
    http://msdn.microsoft.com/en-us/library/cc765775.aspx

    Angela also talked about it @ http://blogs.msdn.com/officedevdocs/archive/2009/01/20/where-is-the-mapi-documentation.aspx

    For what is new and what has changed visit:

    What's New in This Edition
    http://msdn.microsoft.com/en-us/library/cc963762.aspx 

    And if you are looking for sample code related to MAPI then there is no better sample available than MFCMAPI.

    MFCMAPI as a Code Sample
    http://msdn.microsoft.com/en-us/library/cc998258.aspx

    Also don't get confused with "MAPI Canonical Properties" http://msdn.microsoft.com/en-us/library/cc979184.aspx

    Because canonical properties are not real properties and are not defined in MAPI header files, you should NOT use canonical property names in code; instead, you should continue to use the exact MAPI property names in code.

    Now, there are now close to 900 properties documented, including tagged properties and named properties. So let's explore...

  • Brijs Blogging... Looking Beyond the Obvious

    How to set msExchRecipientTypeDetails Active Directory Attribute using VBScript.

    • 1 Comments

    When we move Mailbox from Exchange 2003 to Exchange 2007, it may be shown as Linked Mailbox.

    This issue can occur if the associated external account was set on the user's Microsoft Exchange Server 2003 or Exchange 2000 Server mailbox.

    To resolve the problem, modify the user account attribute msExchRecipientTypeDetails from a value of 2 to a value of 1 using ADSI Edit.

    We can refer to the article mentioned below:

    Or use the sample VBScript given below:

    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.

       1:  Dim obj
       2:  'ToDo: Modifiy the UserAlias, Domain, DomainExtn
       3:  Set obj = GetObject("LDAP://CN=UserAlias,CN=Users,DC=Domain,DC=DomainExtn")
       4:  obj.msExchRecipientTypeDetails = 1
       5:  obj.SetInfo()
       6:  Set obj = nothing
     
    Hope this helps! Enjoy
  • Brijs Blogging... Looking Beyond the Obvious

    Issue: Unable to set recurrence pattern of an appointment or a meeting as every weekday using Outlook Object Model

    • 2 Comments

    The only available recurrence patterns to set from OOM are as below:

    olRecursDaily = 0,

    olRecursWeekly = 1,

    olRecursMonthly = 2,

    olRecursMonthNth = 3,

    olRecursYearly = 5,

    and olRecursYearNth = 6.

    Though we can set every weekday recurrence pattern using UI, Outlook object model does not expose any method to create the pattern as Every Weekday.

    So, We could use "DayOfWeekMask" to workaround the issue;  We found that the mask value is set to 62 on item when we set the recurrence pattern as Every Weekday through Outlook UI [Daily] -> [Every weekday].

    Here is the sample code snippet in VBA and C# to workaround the issue:

    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.

    SAMPLE CODE I (VBA):

       1:  Sub CreateTestAppointment()
       2:      Dim myOlApp As Outlook.Application
       3:      Dim myItem As Outlook.AppointmentItem
       4:      Dim myPattern As Outlook.RecurrencePattern
       5:      Set myOlApp = CreateObject("Outlook.Application")
       6:      Set myItem = myOlApp.CreateItem(olAppointmentItem)
       7:      Set myPattern = myItem.GetRecurrencePattern
       8:      myPattern.RecurrenceType = 1
       9:      myPattern.DayOfWeekMask = 62 
      10:      myPattern.StartTime = "12:00 pm" 'Time each appointment begins
      11:      myPattern.EndTime = "1:00 pm" 'Time each appointment ends
      12:      myPattern.PatternStartDate = #7/1/2009# 'Earliest date appt can  Occur
      13:      myPattern.PatternEndDate = #9/2/2009# 'Latest date appt can occur
      14:   
      15:      myItem.Subject = "TestAppointment"
      16:      myItem.Save
      17:      myItem.Display
      18:  End Sub

     

    SAMPLE CODE II (C#):

       1:          try
       2:              {
       3:                  Outlook.Application oApp =(Outlook.Application) new Outlook.Application();
       4:                  Outlook.AppointmentItem newAppointment =(Outlook.AppointmentItem) oApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
       5:                  Outlook.RecurrencePattern oRecurr = newAppointment.GetRecurrencePattern() ;
       6:                  
       7:                  oRecurr.RecurrenceType = Outlook.OlRecurrenceType.olRecursWeekly;
       8:                  oRecurr.DayOfWeekMask = (Outlook.OlDaysOfWeek)62;
       9:                  oRecurr.StartTime = DateTime.Now.AddHours(2);
      10:                  oRecurr.EndTime = DateTime.Now.AddHours(3);
      11:                  oRecurr.PatternStartDate = DateTime.Now.Date;
      12:                  oRecurr.PatternEndDate = DateTime.Now.Date.AddDays(3);
      13:                  
      14:                  newAppointment.Body = "Test Appointment";
      15:                  newAppointment.AllDayEvent = false;
      16:                  newAppointment.Subject = "Test Appointment";
      17:                  newAppointment.Save();
      18:                  newAppointment.Display(true);
      19:              }
      20:              catch (Exception ex)
      21:              {
      22:                  MessageBox.Show("The following error occurred: " + ex.Message);
      23:              }

    References:

    Hope this helps.

  • Brijs Blogging... Looking Beyond the Obvious

    Issue: Prerequisites Packages are not available for the Office Add-in Setup Project developed using Visual Studio

    • 1 Comments

    We need to add Prerequisites Packages to Office Add-in Setup Project developed using Visual Studio; so that out Add-in works as expected when we deploy it on other machines.

    In case any of pre-requisite packages are not available/listed under Add Prerequisites dialog box(shown below) then we can include user-provided prerequisite packages because Prerequisites dialog box is extensible.

    Here's how we can do it.

    First download the required redistributable prerequisite package from the links below or get it from Microsoft Download Center

    prereq

    And then use Bootstrapper Manifest Generator available @ http://code.msdn.microsoft.com/bmg to add bootstrapper package manifest so that the package would appear in the Prerequisites dialog shown above.

    Also make sure that we select the "Download prerequisites from the same location as my application" option.

    Here is the list of few of common redistributable Pre-requisite packages for Office Add-ins:

    Office PIAs depending on version of Office we are targeting:

    .Net Framework for which we have targeted the Add-in:

    • .NET Framework 3.5
      Microsoft .NET Framework 3.5 contains many new features building incrementally upon .NET Framework 2.0 and 3.0, and includes .NET Framework 2.0 service pack 1 and .NET Framework 3.0 service pack 1.
    • .NET Framework 3.5 Service pack 1
      Microsoft .NET Framework 3.5 Service Pack 1 is a full cumulative update that contains many new features building incrementally upon .NET Framework 2.0, 3.0, 3.5, and includes cumulative servicing updates to the .NET Framework 2.0 and .NET Framework 3.0 subcomponents.
    • .NET Framework Version 2.0 Redistributable Package (x86)
      The Microsoft .NET Framework version 2.0 (x86) redistributable package installs the .NET Framework runtime and associated files required to run applications developed to target the .NET Framework v2.0.
    • .NET Framework Version 1.1 Redistributable Package
      The .NET Framework version 1.1 redistributable package includes everything you need to run applications developed using the .NET Framework.

    VSTO Runtime depending on the version of VSTO used for Add-in developed:

    Fixes

    If you are using Visual Studio 2008 then you have to follow the Workaround mentioned below to get KB908002 listed under add pre-requisites dialog:

    1.    Download and install the fix on a machine which has Visual Studio 2005 installed.
    2.    Navigate to *C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages*, locate KB908002 folder.
    3.    Log on to the machine which has Visual Studio 2008 installed and copy KB908002 folder to *C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages*
    4.    Now, if you go to pre-requisites list on Visual Studio 2008 machine you would see the fix listed.

    References:

    http://msdn.microsoft.com/en-us/magazine/cc163899.aspx

  • Brijs Blogging... Looking Beyond the Obvious

    "Condition is not valid" error on Items.Find for Appointment Item using GlobalAppointmentID as filter

    • 1 Comments

    We are getting "Condition is not valid" error on Items.Find for Appointment Item using GlobalAppointmentID as filter.

    We are using the filter as: strFilter = "[GlobalAppointmentID] = 'apptidhere'" and getting following exception:

    runtime error '-2147352567(80020009)'  "Condition is not valid"

    Then we have tried finding the Item using DSAL  query based on Proptag for GlobalAppointmentID  to avoid exception as below:

    strFilter = "@SQL=""http://schemas.microsoft.com/mapi/id/{6ED8DA90-450B-101B-98DA-00AA003F1305}/00030102"" = 'ApptIDHere'"

    but it would NOT return any Item as result because for both Jet and DASL queries, you cannot restrict on a binary property such as EntryID.

    So, Binary properties are NOT SUPPORTED to Find or Restrict Outlook Items.

    However, We can store GlobalAppointmentID in UserDefinedProperty to find item based on it using Find or Restrict as a workaround.

    Here's what I have done in my sample VBA code and able to get Item from Items.Find using Custom Property :

    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.

       1:  'Creating Apptointment Item with Custom property.
       2:  Sub CreateTestAppointmentWithCustomProp()
       3:      Dim myOlApp As Outlook.Application
       4:      Dim myItem As Outlook.AppointmentItem
       5:      Set myOlApp = CreateObject("Outlook.Application")
       6:      Set myItem = myOlApp.CreateItem(olAppointmentItem)
       7:      myItem.Start = DateAdd("n", 16, Now)
       8:      myItem.End = DateAdd("n", 60, myItem.Start)
       9:      myItem.Subject = "TestAppointment"
      10:      myItem.ItemProperties.Add "GAI", olText, True
      11:      myItem.Save
      12:      myItem.ItemProperties.Item("GAI").Value = myItem.GlobalAppointmentID
      13:      myItem.Save
      14:      myItem.Display
      15:  End Sub
      16:   
      17:  'Finding Item based on Custom Property
      18:  Sub FindItem()
      19:          Dim objOutlook As Outlook.Application
      20:          Set objOutlook = New Outlook.Application
      21:          Dim objNS As Outlook.NameSpace
      22:          Set objNS = objOutlook.Session
      23:          Dim objFolder As Outlook.MAPIFolder
      24:          Set objFolder = objNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
      25:          Dim objAppts As Outlook.Items
      26:          Set objAppts = objFolder.Items
      27:          Dim objAppt As Outlook.AppointmentItem
      28:          
      29:          Dim strFilter As String
      30:          strFilter = "@SQL=""http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/GAI"" = 'ApptIDHere'"
      31:       
      32:          Set objAppt = objAppts.Find(strFilter)
      33:          If objAppt Is Nothing Then
      34:              MsgBox ("Nothing Found")
      35:          Else
      36:              MsgBox ("Appt Found")
      37:          End If
      38:  End Sub

    To get property tag of your custom property for your DASL query we can use MFCMAPI available @ http://www.codeplex.com/MFCMAPI.

    I have also referred following articles:

  • Brijs Blogging... Looking Beyond the Obvious

    How to send deferred delivery email using Exchange Web Services ?

    • 1 Comments

    We can send deferred delivery mail using Exchange Web Services by setting PR_DEFERRED_SEND_TIME and PR_DEFERRED_DELIVERY_TIME MAPI properties as extended properties on the EWS request.

    Here is the sample code in C#:

    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.

       1:  using System;
       2:  using System.Collections.Generic;
       3:  using System.Linq;
       4:  using System.Text;
       5:  using SendMailWithDeferredDelivery.msgex07;
       6:  using System.Net;
       7:  using System.Net.Security;
       8:  using System.Security.Cryptography.X509Certificates;
       9:   
      10:  namespace SendMailWithDeferredDelivery
      11:  {
      12:      class Program
      13:      {
      14:          static void Main(string[] args)
      15:          {
      16:              //Please change the server, domain, username, password 
      17:              ExchangeServiceBinding esb = new ExchangeServiceBinding();
      18:              esb.Credentials = new NetworkCredential("user", "pass!", "domain");
      19:              esb.Url = @"https://<FQDN Server>/EWS/Exchange.asmx";
      20:              
      21:   
      22:              System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
      23:              {
      24:                  // Replace this line with code to validate server certificate.
      25:                  return true;
      26:              };
      27:   
      28:   
      29:              esb.RequestServerVersionValue = new RequestServerVersion();
      30:              esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
      31:   
      32:              // Create a new message.
      33:              MessageType message = new MessageType();
      34:   
      35:              // Define the e-mail address of the recipient of the message.
      36:              EmailAddressType singleRecip = new EmailAddressType();
      37:              singleRecip.EmailAddress = "user@msglab.com";
      38:   
      39:              message.ToRecipients = new EmailAddressType[2];
      40:              message.ToRecipients[0] = singleRecip;
      41:   
      42:              // Set the subject and sensitivity properties.
      43:              message.Subject = "Siberian Tigers";
      44:              message.Sensitivity = SensitivityChoicesType.Personal;
      45:   
      46:              message.ExtendedProperty = new ExtendedPropertyType[2];
      47:   
      48:              message.ExtendedProperty[0] = new ExtendedPropertyType();
      49:   
      50:              message.ExtendedProperty[0].ExtendedFieldURI = new PathToExtendedFieldType();
      51:   
      52:              //NOTE: This PropertyID is equal to PropertyTag "0x3FEF" but you have to use PropertyID and not PropertyTag 
      53:              //otherwise it will NOT work as expected and this will not be visible via OOM or WebDAV, 
      54:              //you have to specify it as Integer value in PropertyTag field 
      55:              //PR_DEFERRED_SEND_TIME
      56:              message.ExtendedProperty[0].ExtendedFieldURI.PropertyTag = "16367";
      57:              
      58:              message.ExtendedProperty[0].ExtendedFieldURI.PropertyType = MapiPropertyTypeType.SystemTime;
      59:   
      60:              //Sending mail in another 5 Mins
      61:              DateTime deliverydatetime;
      62:              System.DateTime today = System.DateTime.Now;
      63:              System.TimeSpan duration = new System.TimeSpan(0,5, 0);
      64:              deliverydatetime = today.Add(duration);
      65:   
      66:              message.ExtendedProperty[0].Item = deliverydatetime.ToUniversalTime().ToString();
      67:   
      68:              //NOTE: This PropertyID is equal to PropertyTag "0x000F" but you have to use PropertyID and not PropertyTag 
      69:              //otherwise it will NOT work as expected and this will not be visible via OOM or WebDAV, 
      70:              //you have to specify it as Integer value in PropertyTag field 
      71:              //PR_DEFERRED_DELIVERY_TIME
      72:           
      73:              message.ExtendedProperty[1] = new ExtendedPropertyType();
      74:   
      75:              message.ExtendedProperty[1].ExtendedFieldURI = new PathToExtendedFieldType();
      76:   
      77:              message.ExtendedProperty[1].ExtendedFieldURI.PropertyTag = "15";
      78:             
      79:              //message.ExtendedProperty[1].ExtendedFieldURI.PropertyTag= "0x000F";
      80:   
      81:              message.ExtendedProperty[1].ExtendedFieldURI.PropertyType = MapiPropertyTypeType.SystemTime;
      82:   
      83:              message.ExtendedProperty[1].Item = deliverydatetime.ToUniversalTime().ToString();
      84:   
      85:               
      86:              // Set the body property.
      87:              message.Body = new BodyType();
      88:              message.Body.BodyType1 = BodyTypeType.HTML;
      89:              message.Body.Value =  "Did you know there are estimated to be only about 400 " +
      90:                                      "of these magnificent creatures left in the wild?";
      91:   
      92:              // Create a CreateItem request.
      93:              CreateItemType createItem = new CreateItemType();
      94:   
      95:              // Specify that the CreateItem operation should directly send the message
      96:              // and save a copy in the Sent Items folder.
      97:              createItem.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
      98:              createItem.MessageDispositionSpecified = true;
      99:   
     100:              DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
     101:              folder.Id = DistinguishedFolderIdNameType.outbox;
     102:   
     103:              TargetFolderIdType targetFolder = new TargetFolderIdType();
     104:              targetFolder.Item = folder;
     105:              createItem.SavedItemFolderId = targetFolder;
     106:   
     107:              createItem.Items = new NonEmptyArrayOfAllItemsType();
     108:              createItem.Items.Items = new ItemType[1] { message };
     109:   
     110:              // Call the CreateItem method and get its response. 
     111:              CreateItemResponseType response = esb.CreateItem(createItem);
     112:   
     113:              // Get the items returned by CreateItem.
     114:              ResponseMessageType[] itemsResp = response.ResponseMessages.Items;
     115:              
     116:          }
     117:      }
     118:  }
     
    EWS Rocks!!!
  • Brijs Blogging... Looking Beyond the Obvious

    Resources for development tests and hands on experience with Microsoft's programming tools and technologies.

    • 1 Comments

    If you are looking for resources to test your development projects then read on... 

    Run IT on a Virtual Hard Disk
    http://www.microsoft.com/vhd

    You can now access the entire catalog of pre-configured Microsoft and partner products and solutions in the VHD format and start evaluating and testing today from www.microsoft.com/vhd.

    Using the power of virtualization, you can now use a series of pre-configured Virtual Hard Disks (VHDs). You can download the VHDs and evaluate them for free in your own environment without the need for dedicated servers or complex installations.

    A virtualization product that supports the VHD format is required to use this virtual machine. Microsoft Virtual PC or Microsoft Virtual Server are provided for free and can be used with these VHD based virtual machines.

    Few of the VHD avalilables:

    And if you are looking for some hands-on experience with Microsoft's programming tools and technologies then refer to the links below:

    Welcome to TechNet Virtual Labs
    http://www.microsoft.com/technet/traincert/virtuallab/default.mspx
    Quickly evaluate and test Microsoft's newest server products through a series of guided, hands-on labs you can complete in 90 minutes or less.

    MSDN Virtual Labs
    http://msdn2.microsoft.com/virtuallabs/
    These Virtual Labs for developers give you hands-on experience with Microsoft's programming tools and technologies.

  • Brijs Blogging... Looking Beyond the Obvious

    How to check that outgoing Outlook Mail Item is with digital signature or encrypted from VSTO Add-in in C#?

    • 2 Comments

    How to capture whether user has checked to send Outlook Mail with digital signature or encrypted from VSTO Add-in in C# ?

    We can use the following code snippet with VSTO SE Outlook Skeleton project to build sample add-in:

    IMPORTANT NOTE: This add-in will only work if we are NOT using Word as default email editor.

    /*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.*/

       1:  using System;
       2:  using System.Windows.Forms;
       3:  using Microsoft.VisualStudio.Tools.Applications.Runtime;
       4:  using Outlook = Microsoft.Office.Interop.Outlook;
       5:  using Office = Microsoft.Office.Core;
       6:   
       7:  namespace OutlookAddin1
       8:  {
       9:      public partial class ThisApplication
      10:      {
      11:          private void ThisApplication_Startup(object sender, System.EventArgs e)
      12:          {
      13:              this.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(ThisApplication_ItemSend);   
      14:          }
      15:   
      16:          private void ThisApplication_Shutdown(object sender, System.EventArgs e)
      17:          {
      18:          }
      19:          private Office.CommandBarButton EncButton = null;
      20:          private Office.CommandBarButton DigButton = null;
      21:          private void ThisApplication_ItemSend(object Item, ref bool Cancel)
      22:          {
      23:              Outlook.MailItem mItem = null;
      24:    
      25:              try
      26:              {
      27:                  mItem = Item as Outlook.MailItem;
      28:   
      29:                  EncButton = (Office.CommandBarButton) mItem.GetInspector.CommandBars.FindControl(Office.MsoControlType.msoControlButton , 718, Type.Missing, true);
      30:                  if (EncButton.State ==  Office.MsoButtonState.msoButtonDown )
      31:                  {
      32:                      MessageBox.Show ("Mail will be Encrypted");
      33:                  }
      34:   
      35:                  DigButton = (Office.CommandBarButton)mItem.GetInspector.CommandBars.FindControl(Office.MsoControlType.msoControlButton, 719, Type.Missing, true);
      36:                  if (DigButton.State == Office.MsoButtonState.msoButtonDown)
      37:                  {
      38:                      MessageBox.Show ("Mail will be Digitally signed");
      39:                  }
      40:                  
      41:              }
      42:              catch (Exception ex)
      43:              {
      44:                  System.Windows.Forms.MessageBox.Show(ex.Message);
      45:                  Cancel = true;
      46:              }
      47:   
      48:          }
      49:          #region VSTO generated code
      50:   
      51:          /// <summary>
      52:          /// Required method for Designer support - do not modify
      53:          /// the contents of this method with the code editor.
      54:          /// </summary>
      55:          private void InternalStartup()
      56:          {
      57:              this.Startup += new System.EventHandler(ThisApplication_Startup);
      58:              this.Shutdown += new System.EventHandler(ThisApplication_Shutdown);
      59:          }
      60:   
      61:          #endregion
      62:      }
      63:  }

    Please refer to following article related to working with CommandBars in Outlook Solution:

    How to Use CommandBars in Outlook Solutions
    http://support.microsoft.com/kb/201095

    The above article also have a Microsoft Excel Macro to generate a list of Outlook 2000/2003 CommandBar control IDs.

  • Brijs Blogging... Looking Beyond the Obvious

    How to send a copy of all SMTP mails to another recipient mailbox using SMTP Event Sink

    • 1 Comments

    Sometime we need to trap all the outgoing/incoming email messages and would like to forward a copy of it to another recipient mailbox.
    Here is sample script to achieve that:

    Step 1: Install Exchange 2003 SDK on your Exchange Server. You can download it at the following link.
    http://www.microsoft.com/downloads/details.aspx?FamilyID=a865936f-50da-47a0-9dce-f24e8307f38d&DisplayLang=en

    Step 2: Open Notepad and Paste the following code to it and save it as forward.vbs

    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.

     

       1:  <SCRIPT LANGUAGE="VBScript"> 
       2:   
       3:  Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus) 
       4:   
       5:  Dim RecpList 
       6:   
       7:  recplist = Msg.EnvelopeFields("http://schemas.microsoft.com/cdo/smtpenvelope/recipientlist")
       8:   
       9:  'Change "administrator@dc.com" to the mailbox address to which you want to send a B’cc copy
      10:  If ( Instr(recplist,"SMTP:administrator@dc.com;") =< 0) then
      11:      recplist = recplist &  "SMTP:administrator@dc.com;" 
      12:  End If
      13:  Msg.EnvelopeFields("http://schemas.microsoft.com/cdo/smtpenvelope/recipientlist") = recplist 
      14:  Msg.EnvelopeFields.update
      15:  WriteLog(Msg.EnvelopeFields("http://schemas.microsoft.com/cdo/smtpenvelope/recipientlist"))
      16:  WriteLog("Done")
      17:  End Sub
      18:   
      19:  Sub WriteLog(ByVal strMessage)
      20:      Dim fs
      21:      Set fs = CreateObject("Scripting.FileSystemObject")
      22:      Dim file
      23:   
      24:  'change "C:\bnewlog.txt" name/path of the log file
      25:      Set file = fs.opentextfile("C:\bnewlog.txt", 8, True)
      26:      file.Write strMessage
      27:      file.Close
      28:  End Sub
      29:   
      30:  </SCRIPT>

    Step 3: Register the event sink
    ========================
    1. Click Start -> Run­, Type "cmd" and Click OK
    2. Type "CD C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts" and Press Enter
    3. Type cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*" and Press Enter
    4. Type cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\forward.vbs" and Press Enter (make sure that the path to forward.vbs is correct)

    Now, all the incoming/outgoing emails bcc'ed/copied to administrator@dc.com.

    To unregister this event, type the following:
    cscript smtpreg.vbs /remove 1 OnArrival SMTPScriptingHost

    Please also refer to the following article 273233:You cannot modify MAPI messages that are trapped in an SMTP transport event sink.

    Feel free to post your comments or request for messaging related development issues.

  • Brijs Blogging... Looking Beyond the Obvious

    BUG: "Value does not fall within the expected range." error after installing VSTO 3.0 MSI package

    • 5 Comments

    If you are getting "There was an error during installation. Value does not fall within the expected range." error along with following exception:

    ************** Exception Text **************
    System.ArgumentException: Value does not fall within the expected range.
    at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
    at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

    and getting prompt as displayed below:

    VSTO_MSI_ISSUE

    Please make sure that, We are not using special character like "&" in the manufacturer property of the VSTO 3.0 Add-in MSI setup project.

    In the above scenario we have Manufacturer Property value as “ABC & XYZ Inc” and we are getting exception as mentioned above when we start Outlook 2007 after installing add-in.

    We can easily see from the snapshot that VSTO runtime is escaping "&" from the file path.

    However, if we remove “&” from the Manufacturer Property value as “ABC XYZ Inc” add-in get installed and loaded as expected.

    So, We should not use special character in the Manufacturer Property for VSTO 3.0 Add-ins MSI setup to workaround this bug.

  • Brijs Blogging... Looking Beyond the Obvious

    SMTP event sink on Exchange Server 2003 is not firing and not working as expected.

    • 1 Comments

    If the SMTP event sink on Exchange Server 2003 is not firing and not working as expected.

    Please make sure that Event sink .vbs file is saved in ANSI Encoding not in UNICODE.

    Because Event sink file in UNICODE will break script parser and hence Event Sink would not work.

    How to save Event Sink file in ANSI Encoding?

    · Open the Event Sink file using Notepad.

    · File -> Save As

    · Select -> Encoding as “ANSI”

    · Save -> Click Yes for “File already exists, Do you want to replace it” prompt.

    For sample SMTP event sink we can refer to the below mentioned article:

    How to add a disclaimer to outgoing SMTP messages in Visual Basic script

    http://support.microsoft.com/kb/317680

  • Brijs Blogging... Looking Beyond the Obvious

    HTML controls are not appearing properly in the email on Outlook 2007

    • 0 Comments

    HTML controls are not appearing properly in the email on Outlook 2007. This behavior of Outlook2007 is by design. Here are link related to the issue.

    · Outlook 2007 uses only Word as the e-mail editor
    http://support.microsoft.com/?id=933793

    · Microsoft Office Outlook 2007 e-mail editor white paper
    http://office.microsoft.com/en-us/outlook/HA102109301033.aspx

    · 2007 Office System Tool: Outlook HTML and CSS Validator
    http://www.microsoft.com/downloads/details.aspx?familyid=0b764c08-0f86-431e-8bd5-ef0e9ce26a3a&displaylang=en

    · Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
    http://msdn2.microsoft.com/en-us/library/aa338201.aspx

    · Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)
    http://msdn2.microsoft.com/en-us/library/aa338200.aspx

    We can refer to "Unsupported HTML Attributes Compared with the HTML 4.01 Specification" of the “Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)” article, it clearly states that what all is supported/unsupported.

    One can use either of the following workarounds:

    Steps to view HTML controls in mail item on Outlook 2007

    · Open the Outlook Mail Item (Double click on the mail item).

    · Click on “Other Action” on Message Ribbon.

    · Select “View in Browser”.

    · A new browser window will open with mail body having all HTML controls.

    Or

    Set AutoPreview (on by default) on Outlook2007. If you add your HTML as an attachment to the message, a user could click on the attachment. It would then be “previewed” in the message and the controls are displayed correctly.

  • Page 3 of 4 (78 items) 1234