Le Café Central de DeVa
let.us.develop.share.messaging.more... DeVa blogs!!
I changed the way of blogging. Re-designed the site & started using the latest Windows Live Writer 2011!! Additionally added Microsoft Translator gadget available @ top of page, so that you can change the page in your preferred language!!
Hi, I am Deva working with Microsoft Dev. Messaging & Collaboration team.
This blog will assist developers who design/develop custom applications using Microsoft Messaging libraries. I will try to touch base other developer related info too.
Let us talk.develop.messaging.share.more.
As we know by default the Display Name of Exchange Mailboxes(Exchange Server 2007 SP2) is in the format of “Firstname Lastname”. I want to change this for the couple of existing mailboxes to “Lastname, Firstname” for one my customer – he preferred non-development stuff!! I tried to do the same using the Exchange Management Shell, which fits for my requirement: > Get-Mailbox “User Name” | Get-User | ?{ $_.Lastname -ne $null } | %{ $dispName=$_.LastName + “, ” + $_.FirstName ; set-mailbox $_.SamAccountName -Displayname $dispName }
In case you want to revert back to the format “Firstname Lastname”, here’s the command for that. > Get-Mailbox “User Name” | Get-User | ?{ $_.Lastname -ne $null } | %{ $dispName=$_.FirstName + ” ” + $_.LastName ; set-mailbox $_.SamAccountName -Displayname $dispName }
You can try this out…
Recently one of my customer updated that they get an different issue with their ASP application. This application running on their Web server that uses MAPI to read the Contacts folder in the Public Folders from Exchange Server 2003 SP2 machine. The user can retrieve his email in outlook and browse the public folders as he is used to, but when this user want to use the ASP page that reads the public folder he fails. Customer receives the following error:
bstrPublicRootID = objInfoStore.Fields.Item(&H66310102).Value Error Description: [Collaboration Data Objects - [MAPI_E_FAILONEPROVIDER(8004011D)]] number: –2147221219 Source: Collaboration Data Objects
During the the troubleshooting, we found that the customer tries to read the contacts in public folders. Customer try to gain programmatic access to Public Folders by assigning the folders collection to an object. Customer cannot gain programmatic access to a public folder from an ASP by stepping through the tree. To do this, certainly the customer needs to use GetFolder, which in turn requires him to know what the RootID of the Public Folder.
So we recommend customer to make use of MAPI property tag (example: bstrPublicRootID = objInfoStore.Fields.Item( &H66310102 ).Value) to get the root ID of the Public Folders, which resolved the issue.
Also in couple of earlier such scenario’s we found this error might happen due to one of the following:
You might don't have permissions: You are trying to access a mailbox that the ASP does not have proper permission for.Check to make sure the ASP is being authenticated into the account you want. Insert this line into your VBScript to find out what account the ASP is running in:
Response.Write("You are logged on as " & Request.ServerVariables("LOGON_USER") & "<br>")
If you are logged in under the anonymous account, you will receive a blank string back.
You might be using Incompatible browser: You are using "NT Challenge Response" as your authentication type, and Netscape Navigator for your browser. Netscape Navigator does not support "NT Challenge Response" as an authentication option. In order to log onto a user's Exchange account, the IIS authentication needs to be set up as "Basic (Clear Text)".
For a safer side, you need to make sure that you don’t have Exchange Server 2003 and Outlook 2003 in the same box. Happy Programming!!
Recently i run into this issue with Windows Server 2008 (x64) & Outlook 2007 SP2 (online – which had earlier Cached mode, later changed back to Online) machine. Whenever i tried to open a message or create a new one, i get this error message - “Could not install the custom actions. The object could not be found”. Later i tried to have a look(bugging) into my machine. I found it’s because of the corrupt forms cache. I fixed the issue like this. 1. Close Outlook. 2. Under C:\Users\ find the folder for the user who's experiencing the problem. Note: Make sure under the Tools, Folder Options menu that system files are not hidden. 3. Go to \AppData\Local\Microsoft\FORMS, and delete the file FRMCACHE.DAT 4. After clearing the FRMCACHE.DAT, restart Outlook.
This steps resolved the issue!! Happy Outlook troubleshooting!!
Reading Journal attachments using Outlook Object Model:
This time, i tried to read all the email and their attachments using Outlook Object Model. I used the following code snippet to do this.
'Code Snippet : How to retrieve Outlook attachments using Visual Basic for Application (VBA)
Dim omailitem As Outlook.JournalItem
Dim myJournal As Outlook.Items
Dim oattach As Outlook.Attachment
Set myNamespace = Application.GetNamespace("MAPI")
Set myJournal = myNamespace.GetDefaultFolder(olFolderJournal).Items
'Total Items available in Folder
Debug.Print "Total Items available in Folder : " & myJournal.Count
For Each Item In myJournal
Set omailitem = Item
'Mail items - Journal Subject & its size
Debug.Print "Item Subject :" & omailitem.Subject & " Size (in bytes):" & omailitem.Size
If omailitem.Attachments.Count > 0 Then
For Each oattach In omailitem.Attachments
If oattach.Type = Outlook.olByReference Then
'If the attachment is ByReference
Debug.Print "By reference : " & oattach.FileName & " Size (in bytes) : " & oattach.Size
ElseIf oattach.Type = Outlook.olByValue Then
'If the attachment is ByValue
Debug.Print "By Value : " & oattach.FileName & " Size (in bytes) : " & oattach.Size
ElseIf oattach.Type = Outlook.olEmbeddeditem Then
'If the attachment is Embdedded
Debug.Print "Embedded item : " & oattach.FileName & " Size (in bytes) : " & oattach.Size
ElseIf oattach.Type = Outlook.olOLE Then
'If the attachment is OLE
Debug.Print "OLE : " & oattach.FileName & " Size (in bytes) :" & oattach.Size
End If
Debug.Print "-------------------"
Next
Oops, i got the values like the following:
Reading attachments and save the attachments in local physical drive/folder:
I done some tweaking with the above code snippet – i am done !! You can see how simple to do programming with Outlook Object Model in few minutes…
Sub JournalMailAttachmentRead()
Dim filepath As String
filepath = "C:\"
oattach.SaveAsFile filepath & oattach.FileName
End Sub
Happy programming!!
If you use Mac Entourage user then this is for you!!
To take advantage of the latest innovations that Exchange 2007 has to offer, Entourage 2008, Web Services Edition uses Exchange Web Services to communicate with Exchange Server. In this update, Entourage uses Exchange Web Services to provide several calendaring improvements. The update includes support for notes, tasks, and category synchronization with the Exchange Server.
Microsoft Entourage 2008 for Mac, Web Services Edition uses Exchange Web Services as the primary protocol to communicate with Exchange Server. In addition to several calendaring improvements, this new version of Entourage synchronizes notes, tasks, and categories with Exchange Server. This update also enables logging that can be used for diagnostic purposes.
You can download it from here.
What do you mean by Microsoft Support Lifecycle policy? Microsoft Support Lifecycle policy provides consistent and predictable guidelines for product support availability when a product releases and throughout that product’s life.
The Microsoft Support Lifecycle policy took effect in October 2002, and applies to most products currently available through retail purchase or volume licensing and most future release products. Through the policy, Microsoft will offer a minimum of:
For more information, please refer the following articles:
After created couple of journal items in my test lab, i thought this time i want to play around with the Journal items. Also i want to try the following programmatically: 1) iterate all the available journal items 2) Restrict the values with a (if the Lastmodificationtime > ‘23/9/2009’) specific time frame
For this i used Items(index). Here index is the index number of a journal entry or a value used to match the default property of a journal entry, to return a single JournalItem object from a Journal folder.
You can try this code snippet:
'[Code Snippet: Outlook Object Model API & VBA]
Dim myNamespace As Outlook.NameSpace
Dim myItems As Outlook.Items
Dim myItem As Object
Set myItems = myJournal.Restrict("[LastModificationTime] > '23/9/2009'")
For Each myItem In myItems
If (myItem.Class = olJournal) Then
MsgBox myItem.Subject & ": " & myItem.LastModificationTime
Wow, you can find the results. Just you can juggle around with the relevant Restrict/Find with the items based on you requirement
I want to share my research (that i tried to play around with Journal items) with respect to Outlook Object Model API to you.
How to create the new Journal Item programmatically using Outlook Object Model?
Now, we can try how we can create a new Journal Item.Code snippet: Creating a new Journal Item with Outlook Object Model & VBA
'Creates a new journal item
Dim objMail As Outlook.JournalItem
'Create journal mail item
Set objMail = Application.CreateItem(olJournalItem)
With objMail
.Body = "First Journal Item"
.Companies = "ABC Corp"
.Subject = "First Journal Item"
.Importance = olImportanceHigh
.Save
End With
How it will look like?
Where i can find this in Outlook (i tried Outlook 2007)?
1) Open Outlook. Select ‘Folder list’2) From Left hand pane, you can see “All Folders/All Outlook Items”. Select “Journal”3) You may get this alert. Select “Yes” to proceed further.
4) You can see the item in Outlook:
I found this interesting blog post from John Durant with respect to VBA.
Why VBA Still Makes Sense Not infrequently I am asked, “So, should I use VBA? Is it going to be around in Office 2010? Is it supported? Should I migrate away from VBA now? Can I count on this technology?” (Here I go with a response!) These are fair questions, because customers need to know that the software systems they employ are ones they can count on. There’s no question that the IT landscape in terms of teams, tools, software, networks, and so forth have changed dramatically since 1993, when VBA, or Visual Basic for Applications, made its way into Excel. But, VBA still has a place in this world. It still makes sense, and I’ll explain why. First, here are some answers: 1) VBA is included in Office 2010 much as it was in Office 2007. 2) It is indeed supported 3) You should continue to use VBA where it fits the needs of our business and migrate only if the need arises. Let me elaborate on #3 a little more, because it is the locus of most questions and issues. In contrast to 1993, business productivity solution developers on the Microsoft Office platform have more options in terms of what they use to create, build, deploy, and maintain solutions. For example, many developers now target the .NET Framework, and they are accustomed to using VB.NET, C#, or another .NET-compatible language. Many of these developers use Visual Studio .NET, and they are building a wide variety of solutions that integrate Web, databases, middleware, and client applications. More importantly, the user experience is quite different from 1993. Now, users are working in a highly collaborative, real-time sharing, online/offline, mobile, global world. They are populating documents with data from a wide variety of sources, and they are re-purposing the documents and data in very creative ways. In 1993, users worked mostly in a monovalent way. Work was done in an exclusive application that didn’t have the broad reach into databases and Web sites like today. Importing CSV files was the primary way of ‘reaching’ into other data. Sharing consisted of saving a spreadsheet up to a file share. Customizing the application was primarily the task of users. Most IT departments had other things on their mind than tinkering with Office customizations. VBA gained huge popularity because of its ability to allow a non-greenscreen programmer to customize her or his application experience. For example, a user could write a VBA ‘script’ or macro that would automate repetitive tasks and save a ton of time. Over the years, many hundreds of millions of documents have been imbued with this kind of code and saved users untold numbers of hours. The good news: Even though the user context has changed a lot since 1993, 1997 and beyond, using VBA can still help users save time and effort by automating tasks and customizing their Microsoft Office experience. And, as the application features have evolved to adapt to new user needs has also evolved and grown. Gladly, VBA has remained in step with these evolutionary changes. For example: a great little routine I wrote a long time ago is some VBA that I hooked up to a custom button in Outlook. It allows me, with the click of a button, to save off the attachments for any number of selected emails. The code loops through all selected emails, saves the attachments to a central location I have designated with some logic about how they are stored there so I can sort and find them easily. It then optionally deletes the selected emails. It’s a great little routine that saves me lots of time. So, what’s the VBA authoring experience like? What are the advantages? 1. You can record macros in some of the applications. So, if there is a task you do over and over, just start the macro recorder and the Office application will communicate with the VBA environment for you and write the code for you. You can then re-run this macro any time to run the steps automatically. 2. OK—recording macros is great, but it’s not always enough. And, there are some applications that, while not endowed with full macro-recording capability, still allow you to write the code yourself. VBA really sets itself apart by having such a rich set of built-in tools. First, you have a rich Visual Basic Editor (VBE). You can get the entire information from his available blog post: John Durant's WebLog : Why VBA Still Makes Sense… Really it’s makes sense, why VBA still makes sense….
Not infrequently I am asked, “So, should I use VBA? Is it going to be around in Office 2010? Is it supported? Should I migrate away from VBA now? Can I count on this technology?” (Here I go with a response!)
These are fair questions, because customers need to know that the software systems they employ are ones they can count on. There’s no question that the IT landscape in terms of teams, tools, software, networks, and so forth have changed dramatically since 1993, when VBA, or Visual Basic for Applications, made its way into Excel. But, VBA still has a place in this world. It still makes sense, and I’ll explain why.
First, here are some answers: 1) VBA is included in Office 2010 much as it was in Office 2007. 2) It is indeed supported 3) You should continue to use VBA where it fits the needs of our business and migrate only if the need arises.
Let me elaborate on #3 a little more, because it is the locus of most questions and issues.
In contrast to 1993, business productivity solution developers on the Microsoft Office platform have more options in terms of what they use to create, build, deploy, and maintain solutions. For example, many developers now target the .NET Framework, and they are accustomed to using VB.NET, C#, or another .NET-compatible language. Many of these developers use Visual Studio .NET, and they are building a wide variety of solutions that integrate Web, databases, middleware, and client applications. More importantly, the user experience is quite different from 1993. Now, users are working in a highly collaborative, real-time sharing, online/offline, mobile, global world. They are populating documents with data from a wide variety of sources, and they are re-purposing the documents and data in very creative ways.
In 1993, users worked mostly in a monovalent way. Work was done in an exclusive application that didn’t have the broad reach into databases and Web sites like today. Importing CSV files was the primary way of ‘reaching’ into other data. Sharing consisted of saving a spreadsheet up to a file share. Customizing the application was primarily the task of users. Most IT departments had other things on their mind than tinkering with Office customizations. VBA gained huge popularity because of its ability to allow a non-greenscreen programmer to customize her or his application experience. For example, a user could write a VBA ‘script’ or macro that would automate repetitive tasks and save a ton of time. Over the years, many hundreds of millions of documents have been imbued with this kind of code and saved users untold numbers of hours.
The good news: Even though the user context has changed a lot since 1993, 1997 and beyond, using VBA can still help users save time and effort by automating tasks and customizing their Microsoft Office experience. And, as the application features have evolved to adapt to new user needs has also evolved and grown. Gladly, VBA has remained in step with these evolutionary changes. For example: a great little routine I wrote a long time ago is some VBA that I hooked up to a custom button in Outlook. It allows me, with the click of a button, to save off the attachments for any number of selected emails. The code loops through all selected emails, saves the attachments to a central location I have designated with some logic about how they are stored there so I can sort and find them easily. It then optionally deletes the selected emails. It’s a great little routine that saves me lots of time.
So, what’s the VBA authoring experience like? What are the advantages?
1. You can record macros in some of the applications. So, if there is a task you do over and over, just start the macro recorder and the Office application will communicate with the VBA environment for you and write the code for you. You can then re-run this macro any time to run the steps automatically.
2. OK—recording macros is great, but it’s not always enough. And, there are some applications that, while not endowed with full macro-recording capability, still allow you to write the code yourself. VBA really sets itself apart by having such a rich set of built-in tools. First, you have a rich Visual Basic Editor (VBE).
You can get the entire information from his available blog post: John Durant's WebLog : Why VBA Still Makes Sense… Really it’s makes sense, why VBA still makes sense….
Per TechNet article, using Office Outlook 2007 with Microsoft Exchange Server 5.5 is not supported.