Hobby Chef

Jive into Messaging world - Site Home - MSDN Blogs

Blog - Title

  • Jive into Messaging world

    Draft: How to take EWS/OWA/ETL trace to troubleshoot Exchange Web Services issues – EXCHANGE 2007 & 2010

    • 0 Comments

    THIS IS A DRAFT DOCUMENT AND MAY CHANGE WITHOUT PRIOR NOTICE.

    PURPOSE: Collect ETL trace from Exchange Server 2007 & 2010 to troubleshoot Exchange Web Services related issues.

    Applies to: Microsoft® Exchange Server© 2007 & 2010

    Steps

    1) Go to CAS Server and fire up Extra.exe (%PROGRAMFILES%\Microsoft\Exchange Server\Bin\ExTRA.exe)
    2) This will bring the following window, click on ‘Select a task’

    image

    3) Click on “Trace Control”

    image

    4) Configure the trace options, file location, maximum file size (100-200mb should be enough for normal scenarios)
    5) Select sequential logging, and run traces for a time period in which you should be able to reproduce the issue. Usually 300 seconds are good enough to switch over and reproduce the error.
    6) Click “Set components and tags for the type of tracing selected”
    7) Type of tracing will be “6. OWA Tracing”

    image

    8) Under trace types, select all of them to get a verbose log
    9) Under components, OWA will be selected by default – you might want to uncheck that as it will add logs for OWA traffic as well
    10) Choose trace components according to your problem, in basic scenarios and EWS issues MSExchangeWebServices should be sufficient.
    11) These are the providers which looks good to get a detailed log and uncovering the hidden issues somewhere in the communication.
                        a. ADProvider
                        b. ADRecipientCache
                        c. ADExpansion
                        d. AuthenticationProvider
                        e. Common
                        f. Diagnostics
                        g. MSExchangeWebServices
                        h. NetworkingLayer
    12) Once done, hit Start tracing

    image

    13) It will run the trace for the specified duration, keep it running and reproduce the problem

    image

    14) Once done it will generate a binary file (.ETL) which contains all the proprietary & confidential debugging information related to the product.

    15) Take instructions from the Microsoft Support Professional on how to send the file back to him/her.

    DISCLAIMER: THE STEPS BELOW CAN IMPACT THE PERFORMANCE OF THE EXCHANGE SERVER AND MUST BE PERFORMED IN GUADIANCE OF MICROSOFT SUPPORT PROFESSIONAL. IN NO EVENT SHALL MICROSOFT, ITS AUTHORS, OR ANYONE ELSE INVOLVED IN THE CREATION, PRODUCTION, OR DELIVERY OF THE DOCUMENT BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE DOCUMENTATION, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

  • Jive into Messaging world

    Trouble updating contacts’ physical addresses using EWS Managed API?

    • 1 Comments

    This happened to be a second recent case among many others facing the similar issue, and they could not update an existing contact using EWS Managed API.

    I got this customer, like all others complaining that they cannot set the contact’s Physical Address to a blank value. The same contact can be updated using EWS SOAP API but not with managed API… hmm… I knew the answer already Smile

    Error Message: The request failed schema validation: The element 'Updates' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has incomplete content. List of possible elements expected: 'AppendToItemField, SetItemField, DeleteItemField' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.

    Here is the code which was causing the trouble

            static void UpdateContact(ExchangeService svc,ItemId id)
            {
                Contact myContact = Contact.Bind(svc, id);
     
                PhysicalAddressEntry paEntryHome = null;
                PhysicalAddressEntry paEntryBusiness = null;
     
                paEntryHome = new PhysicalAddressEntry();
                paEntryHome.Street = "";
                paEntryHome.City = "";
                paEntryHome.PostalCode = "";
                paEntryHome.State = "";
                paEntryHome.CountryOrRegion = "";
     
                paEntryBusiness = new PhysicalAddressEntry();
                paEntryBusiness.Street = "";
                paEntryBusiness.City = "";
                paEntryBusiness.PostalCode = "";
                paEntryBusiness.State = "";
                paEntryBusiness.CountryOrRegion = "";
     
                myContact.PhysicalAddresses[PhysicalAddressKey.Home] = paEntryHome;
                myContact.PhysicalAddresses[PhysicalAddressKey.Business] = paEntryBusiness;
                
                try
                {
                    myContact.Update(ConflictResolutionMode.AlwaysOverwrite);
                }
                catch(Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
     
            }

     

    So what was the trouble in the code, it look pretty neat.. huh? Not exactly. You are creating a new instance of PhysicalAddressEntry instead of using the existing object given by Managed API..

    Only, few lines of code change and it started to work like charm.. here is the working code for the same.

     

            static void UpdateContact(ExchangeService svc,ItemId id)
            {
                Contact myContact = Contact.Bind(svc, id);
     
                PhysicalAddressEntry paEntryHome = null;
                PhysicalAddressEntry paEntryBusiness = null;
     
                paEntryHome = myContact.PhysicalAddresses[PhysicalAddressKey.Home];
                paEntryBusiness = myContact.PhysicalAddresses[PhysicalAddressKey.Business];
     
                paEntryHome.Street = "";
                paEntryHome.City = "";
                paEntryHome.PostalCode = "";
                paEntryHome.State = "";
                paEntryHome.CountryOrRegion = "";
     
                paEntryBusiness.Street = "";
                paEntryBusiness.City = "";
                paEntryBusiness.PostalCode = "";
                paEntryBusiness.State = "";
                paEntryBusiness.CountryOrRegion = "";
                
                try
                {
                    myContact.Update(ConflictResolutionMode.AlwaysOverwrite);
                }
                catch(Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
     
            }

     

    Hope this helps you all.

    Happy coding / debugging!!!

  • Jive into Messaging world

    Where are you Outlook???

    • 0 Comments

    So I got this friend of mine who works for MS IT and was curious to find Outlook’s install location programmatically irrespective of 32/64 bit installation of OS or Outlook.

    First thought was registry, but that gets little messy.. you go to HKCR & then parse through it to find the location of Outlook.exe… I didn’t like that much, and that was not sure shot way… I could delete the Outlook.exe and it will still point me to the same path. You might ask why would someone delete the Outlook.exe and leaving other registry entries? My answer is because you can and then the registry solution will break.

    So why not ask the Outlook itself where are you buddy? Nice, you would say, if only he can speak… yes he can!!! Here is how its done in C#

    I am using Reflection to create an object to Outlook.Application. You can use this to create an object of any COM Object though. Whenever you create the object to a COM server inside EXE, its EXE is launched if not running already. So all you need to do is use System.Diagnostics.Process class to get its Process Path.

    using System;
    using System.Reflection;
    using System.Diagnostics;
    
    namespace OutlookLocationFinder
    {
        class Program
        {
            static void Main(string[] args)
            {
                System.Type objType = null;
                object comObject = null;
                string version = string.Empty;
                Process[] p = null;
    
                try
                {
    
                    // Create an object to Outlook.Application , replace with your COM Server's ProgID
                    objType = System.Type.GetTypeFromProgID("Outlook.Application");
    
                    // Activate the object
                    comObject = System.Activator.CreateInstance(objType);
    
                    // This is Outlook specific, I am calling the member property to get the version of Outlook
                    version = (string)objType.InvokeMember("Version",
                                   BindingFlags.InvokeMethod, null, comObject, null);
                }
                catch
                {
                    Console.Write("Unable to create the object of type \"Outlook.Application\"");
                }
    
                // Whenever you create the object to a COM server inside EXE, its EXE is launched if not running already
                // Now, just get hold of the Process by its name
                p = Process.GetProcessesByName("Outlook");
                
                // Beware there could be multiple instances running of the same application, we just care about first one.
                if (null != p && p.Length > 0)
                    Console.WriteLine("Outlook ({0}) is launched from: {1}", version, p[0].MainModule.FileName);
                else
                    Console.WriteLine("Outlook does not seem to be installed properly on this machine, could not find process running on local machine");
    
                Console.Write("Press any key to exit.");
                Console.ReadKey(false);
            }
        }
    }
    
    Happy Coding / Debugging !!!
     
  • Jive into Messaging world

    WP7: Quick Timer: Sample Application for Windows Phone 7

    • 0 Comments

    No wonder the development of WP7 apps is super easy and very much fun. I was looking for a quick hand timer application with laps and of course I could find hundreds of Apps on the Marketplace. I thought why not build one for myself and see how difficult it is.

    Here is my first application and it did not took more than 15min to code the logic... yeah UI design took over 45min :)

     

     

     

     

     

    Download the source code from below, feel free to use the code of this application for personal & educational purposes. Written permission is required prior to any commercial use of the code.

     

    Have fun, happy coding!!!

  • Jive into Messaging world

    FYI: BUG: Attachments.Add fails for POP3/IMAP only accounts when the attachment type is Outlook.olEmbeddedItem

    • 1 Comments

    Problem: Attachments.Add fails only for POP3/IMAP accounts when the attachment type is Outlook.olEmbeddedItem

    Cause: This is a known issue with Microsoft Product (Outlook 2010) and we have an internal fix available. The fix is expected to go public with the release of next Service Pack for the product.

    Repro Code:

    1. Setup a POP3 only profile
    2. Make sure that there is at least one mail item in the Inbox.
    3. Make the Inbox the current folder and run the following code:

    Sub TestAddAttachment()
        Dim objItem As Outlook.MailItem
        Dim objAttachments As Outlook.Attachments
        Dim objItemAtt As Outlook.MailItem
       
        Set objItem = Application.CreateItem(olMailItem)
        objItem.Subject = "TestAddAttachment"
        Set objItemAtt = Application.ActiveExplorer.Selection.Item(1)
        Set objAttachments = objItem.Attachments
        objAttachments.Add objItemAtt, Outlook.olEmbeddeditem, 1, objItemAtt.Subject
        objItem.Display
    End Sub

    Actual Result:

    objAttachments.Add raises an error:

    Run-time error '-2147221233 (8004010f)':
    The attempted operation failed. An object could not be found.

    Expected Result: 

    No error

    Workaround:

    There is a workaround by saving the embedded item to the file system, similar to the following:

    Sub TestAddAttachmentWorkaround()
        Dim objItem As Outlook.MailItem
        Dim objAttachments As Outlook.Attachments
        Dim objItemAtt As Outlook.MailItem
        Dim strPath As String
       
        Set objItem = Application.CreateItem(olMailItem)
        objItem.Subject = "TestAddAttachment"
        Set objItemAtt = Application.ActiveExplorer.Selection.Item(1)
        strPath = Environ("TEMP") & "\testmsg.msg"
        objItemAtt.SaveAs strPath, olMSG
        Set objAttachments = objItem.Attachments
        objAttachments.Add strPath, Outlook.olEmbeddeditem, 1, objItemAtt.Subject
        objItem.Display
        Kill strPath
    End Sub

    Please contact Microsoft PSS if you are affected by this problem and cannot wait until next service pack release of Outlook 2010.

  • Jive into Messaging world

    Exchange 2007: Transport error when sending emails using TLS (0x80040213)

    • 1 Comments

    Ok, this was a fun case and I never had such fun on a CDOSYS case & I am lying. I spent nearly all day in hunting down a Transport failure issue when sending emails using CDOSYS and Exchange 2007 as backend.

    This was the configuration of the default Receive connector, pretty secured…huh??? Yeah!!!

    image

    Goal:  Send secured emails using CDOSYS over TLS using BASIC authentication

    Challenges:  ‘80040213’ The transport failed to connect to the server.

    I confirmed that the issue is not in connectivity and I could easily do a telnet to port 25 and get the banner and supported verbs lists. The problem was that I could not do STARTTLS… heck it was not listed in the verbs list. With my “Mr. Fix It” cap on I took an ETL trace and started debugging the issue.

    I concluded that the certificates was the blocking issue, and I quickly turned back to the Event Viewer to see the following event log

    Event Type:       Error

    Event Source:    MSExchangeTransport

    Event Category: TransportService

    Event ID:          12014

    Date:                7/23/2010

    Time:                6:26:25 PM

    User:                N/A

    Computer:         MSGEX07

    Description:

    Microsoft Exchange couldn't find a certificate that contains the domain name msgex07.msglab.com in the personal store on the local computer. Therefore, it is unable to support the STARTTLS SMTP verb for the connector Default with a FQDN parameter of msgex07.msglab.com. If the connector's FQDN is not specified, the computer's FQDN is used. Verify the connector configuration and the installed certificates to make sure that there is a certificate with a domain name for that FQDN. If this certificate exists, run Enable-ExchangeCertificate -Services SMTP to make sure that the Microsoft Exchange Transport service has access to the certificate key.

     

     

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    clip_image001

    Once I have resolved the Certificate issues, I can see the STARTTLS verb supported by the Exchange server.

    clip_image001[5]



    If you do not see STARTTLS and DO see the event log entry then you need to verify the following things

    1) The FQDN of the server which is specified in the code, abc.xyz.com MUST match with the FQDN of the certificate

    2) The FQDN of the Receive Connector MUST match the FQDN of the certificate

    3) The Certificate in itself should be a valid one (not expired or with missing root CA)

    You can verify these details with the help of your Exchange Admin and the following Powershell Cmdlet

    Get-ExchangeCertificate | fl

    Enable-ExchangeCertificate –Services SMTP

    New-ExchangeCertificate

    See the below link for more information

    Reference: http://technet.microsoft.com/en-us/library/bb430748.aspx

  • Jive into Messaging world

    Exchange 2010: OWA Customization: Preview forms does not works in Conversation Mode

    • 0 Comments

    I recently had couple of customer reporting that their existing/new OWA customization code is not working in Preview mode.

    You will notice the following error message displayed instead..

    "This type of message isn't fully supported in Conversation mode. Click here to open the full version, which may show you more details or features."

    This same form should work in Exchange 2007.

    I have two news here, first there has been changes to Registry.xml and there has been couple of new clients support added. Make sure you have all of them listed in your Registry.xml when you run the test on Exchange 2010

        <Client Application="MSIE" MinimumVersion="7" Platform="Windows NT" />
        <Client Application="MSIE" MinimumVersion="7" Platform="Windows 2000" />
        <Client Application="MSIE" MinimumVersion="7" Platform="Windows 98; Win 9x 4.90" />
        <Client Application="Safari" MinimumVersion="3" Platform="Macintosh" />
        <Client Application="Firefox" MinimumVersion="3" Platform="Windows NT" />
        <Client Application="Firefox" MinimumVersion="3" Platform="Windows 2000" />
        <Client Application="Firefox" MinimumVersion="3" Platform="Windows 98; Win 9x 4.90" />
        <Client Application="Firefox" MinimumVersion="3" Platform="Macintosh" />
        <Client Application="Firefox" MinimumVersion="3" Platform="Linux" />
        <Client Application="Chrome" MinimumVersion="1" Platform="Windows NT" />

    Secondly, This issue is “by design” that the custom forms will not work in Conversation Mode for now.

    This issue seems like something obvious that the product group will want to fix in the next major version.   It is currently not under consideration for a service pack or rollup for Exchange 2010, but may be considered at some point based on customer feedback.

    If this issue is causing troubles for you then I would request you to contact PSS.

  • Jive into Messaging world

    System.Net.Mail cannot send secured email using SMTP over SSL aka SMTPS protocol

    • 0 Comments

    This is just FYI that we know the limitation of System.Net.Mail classes and its incapability of sending secured emails over SSL / SMTPS.

    The SmtpClient class only supports the SMTP Service Extension for Secure SMTP over Transport Layer Security as defined in RFC 3207. In this mode, the SMTP session begins on an unencrypted channel, then a STARTTLS command is issued by the client to the server to switch to secure communication using SSL. See RFC 3207 published by the Internet Engineering Task Force (IETF) for more information.

    An alternate connection method is where an SSL session is established up front before any protocol commands are sent. This connection method is sometimes called SMTP/SSL, SMTP over SSL, or SMTPS and by default uses port 465. This alternate connection method using SSL is not currently supported.

    This is the limitation of SmtpClient and publically documented here but often missed

    http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.enablessl.aspx

    You may also ask your service provider to see if they can support STARTTLS sessions, which is fairly secure and not too complex to implement.

    You have an option to use either CDOSYS / System.Web.Mail from .Net 1.1 which internally uses CDOSYS to send out email. CDOSYS had this support but then the support was dropped in System.Net.Mail. Some may argue that why this downgrade, when CDOSYS had this support why System.Net.Mail drop this support – well this is not really a downgrade but a design decision that they made to support only one of the two optional ways to implement SSL while the SMTPS is used less commonly when compared to TLS.

    Here is the sample code that can do the job for you, please do not forget to add a reference to System.Web.dll into your project for this to work. I have compiled it on VS2008 and found it working.

    Please do proper testing before using this code in production and treat this piece of code just for the sake of educational purpose.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.Mail;
     
    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
     
                MailMessage msg = new MailMessage();
                msg.To = "to@server.com";
                msg.From = "from@server.com";
                msg.Subject = "This is a test email using System.Web.Mail";
                msg.Body = "Hello There!!!";
                msg.BodyFormat = MailFormat.Text;
     
                // SMTP Server to use
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.server.com");   
     
                // SMTP Port to use
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");                 
                
                // Send using Value, leave it to 2 for sending via SMTP Port specified
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");                        
                
                // Use SSL : 0 = False, 1 = True
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");                       
     
     
                // Authentication mode: 
                //  0 - Anonymous
                //  1 - Basic
                //  2 - NTLM
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
     
     
                // Username and password to connect to the SMTP Server
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "USERNAME_HERE");
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "PASSWORD_HERE");
     
                SmtpMail.Send(msg);            
     
            }
        }
    }
  • Jive into Messaging world

    HOTFIX: .NET 4.0 (System.Net.Mail) Unable to send emails with large attachments (more than 3MB)

    • 1 Comments

     

    We have an official release for the issue and if you are facing this problem then I would recommend you contacting PSS and refer to this blog

    http://blogs.msdn.com/b/vikas/archive/2010/04/05/bug-net-4-0-system-net-mail-unable-to-send-emails-with-large-attachments-more-than-3mb.aspx

    I am expected it to be released in a public KB in some time but for the time being you can request for the hotfix by contacting PSS

    UPDATE - 7/21/2010

    If you prefer not to contact PSS, you can download the hotfix by yourself from the following link.

    http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226

  • Jive into Messaging world

    FYI: MAPI Application does not work when running from Windows Service (MAPI_E_NETWORK_ERROR)

    • 0 Comments

    I recently had two cases where the MAPI application was failing while creating a dynamic profile calling IMsgServiceAdmin::ConfigureMsgService.

    Although if the same application is executed outside Service Control Manager then it work and is able to create the profile just fine.

    In both cases we found out that the older versions of OLMAPI32 had this problem and you MUST upgrade to the latest version 12.0.6514.5000 or above

    Publically available latest version is “October 2009 security update” - http://support.microsoft.com/kb/972363

  • Jive into Messaging world

    Webcast: Enhancements in VSTO 4.0 Deployment for Office 2007/2010

    • 0 Comments

     

    One of my colleague, Akash, today presented this webcast where he talked about the enhancements in VSTO 4.0 Deployment for Office 2007/2010 using Visual Studio 2010. The session demonstrate how to use ClickOnce post-deployment action and Deploying Multiple Office Solutions in a single click-once installer.

    Here is the link for the same, this has been hosted on Cloud Smile

    http://zeollar.cloudapp.net/Session/121

  • Jive into Messaging world

    BUG: Outlook: Error thrown by Outlook 2007 when all attendees of a meeting are removed programmatically before sending it

    • 0 Comments

    THIS IS JUST FYI AND IF YOU ARE FACING THE SIMILAR ISSUE THEM PLEASE LET ME KNOW. WE ARE AWARE OF THIS ISSUE AND ALREADY WORKING ON A FIX FOR THE SAME.

    When using Outlook UI if a user tries to send a meeting request without any recipient he is prompted by the following prompt

    "The meeting cannot be sent because there are no recipient names in the To box. Would you like to save and close this meeting instead?" - Yes/No

    ..but if you try to send the meeting programmatically using Outlook 2007 SP2 , you will not get the same prompt but gets this error message

    "Out of memory or system resources. Close some windows or programs and try again."

    Although this works fine on all other versions like Outlook 2003, 2007 SP1, & 2010 except Outlook 2007 SP2. In all other versions the meeting is saved locally as Appointment instead.

    CODE TO REPRODUCE THE BUG & WORKAROUND (SEE CODE COMMENTS)

    Dim WithEvents oInspectors As Inspectors
    Dim WithEvents oItem As AppointmentItem 
    
    Sub Init()
    Set oInspectors = Application.Inspectors
    End Sub 
    
    Private Sub oInspectors_NewInspector(ByVal Inspector As Inspector)
        If TypeName(Inspector.CurrentItem) = "AppointmentItem" Then
           Set oItem = Inspector.CurrentItem
        End If
    End Sub 
    
    Private Sub oItem_Write(Cancel As Boolean)
        For i = oItem.Recipients.Count To 1 Step -1
            oItem.Recipients.Remove (i)
        Next 
    
    'If we leave the Cancel = False then we get the error message
    ' Workaround Code: 
    ' This will emulate the way Outlook does it in other versions by Saving the appointment to local calendar 
    
        If oItem.Recipients.Count = 0 Then
            Cancel = True 
            oItem.Close olSave
        End If 
    
    End Sub

  • Jive into Messaging world

    We are Open, says PST to Outlook :-)

    • 0 Comments

    This is pretty exciting development which came yesterday as Microsoft announced the availability of two new open source projects to facilitate interoperability with Outlook PST files.

    Now start your engines and start thinking of solutions that you can build upon it, and some of you who were reverse engineering the PST format and already doing that have a real good news.. as it went official now ;-)

    The two open source projects, available on Copeplex under the Apache 2.0 license are the following:

    • The PST Data Structure View Tool (http://pstviewtool.codeplex.com/) is a graphical tool allowing the developers to browse the internal data structures of a PST file. The primary goal of this tool is to assist people who are learning .pst format and help them to better understand the documentation.
    • The PST File Format SDK (http://pstsdk.codeplex.com/) is a cross platform C++ library for reading .pst files that can be incorporated into solutions that run on top of the .pst file format. The capability to write data to .pst files is part of the roadmap will be added to the SDK.

    Read more about it here (blog has some videos as well)

    http://www.microsoft.com/presspass/press/2010/may10/05-24PSTToolsPR.mspx

    http://blogs.msdn.com/b/interoperability/archive/2010/05/24/two-open-source-projects-to-facilitate-interoperability-with-outlook-pst-data-files.aspx

  • Jive into Messaging world

    WebDAV can expose private meetings/appointments to users who should not see them.

    • 0 Comments

    This is quite frequently asked and with surprise & worries mixed together… Why WebDAV is able to see my Private meetings/appointments? Isn’t this a security breach? How can I get it fixed?

    The answer is very simple, not this is not a bug. This is how it should work and then comes a even bigger surprise “FTW” from the receiver of this message.

    Let’s understand why this is so and what you should do and what you should not do to prevent such scenarios.

    There is no such thing as Private appointments/meetings in real sense and it’s a feature of the email client like Outlook/OWA. Exchange Server treat all items as same. Every calendar item has a field name “Sensitivity” which can store a value of “Normal”, “Personal”, “Private” & “Confidential”.

    In case of Private appointments this is marked as “Private” which allow the email client (Outlook/OWA) to decide if this should be displayed to the user or not. With that said, this is decided at the business logic layer in the email client.

    Now coming to the WebDAV, it has no business logic of itself and gives the requestor a raw output of the items/properties and leave it up to the client how they want to process those items. If you are writing a email client and want to have the same behavior as Outlook does then you should honor the value of Sensitivity before displaying the Item to the user.

    Exchange Server does not support Item level permissions and this is just a way to give users some sort of liberty to share restricted items when all the users are using Outlook or OWA. If you have users in your organization which may use other email clients then you should not give them Read access to your calendar/Tasks folder. This will prevent them from reading your private (or not so private?) items.

    This has been documented here as well:

    Outlook 2007: http://office.microsoft.com/en-us/outlook/HA100750811033.aspx?pid=CH100788801033

    Outlook 2003: http://office.microsoft.com/en-us/outlook/HP030741291033.aspx

  • Jive into Messaging world

    BUG: .NET 4.0 (System.Net.Mail) Unable to send emails with large attachments (more than 3MB)

    • 1 Comments

    This is probably the first bug reported by customer so far for System.Net.Mail Class in .NET 4.0 Framework, or at least the first one I worked on. This was pretty straight forward repro and I did not had to do much to reproduce the issue locally.

     

     static void Main(string[] args)
    
            {
    
                SmtpClient client = new SmtpClient("contoso_smtp_server");
                client.Credentials = new System.Net.NetworkCredential("User1", "Password", "contoso");
    
     
                MailMessage msg = new MailMessage("user1@contoso.com", "user2@contoso.com", "Large Attachment Mail", "Large Attachment - Test Body");
    
                Attachment attachment = new Attachment(@"d:\3mb.dat");
                msg.Attachments.Add(attachment);
    
                client.Send(msg);
    
          
            }

    That was the simplest code you could possibly write to send out email using SNM but the problem is it Fail with an “Error in sending email” message. So I looked around what was happening and found that the problem was not directly related to SNM but its underlying classes and specifically the Base64Encoding class which was used as default method of encoding emails attachments while sending.

    That saved me more troubleshooting and I changed the way the attachments were being encoded from Base64 to 7Bit and it worked like charm.

    So all you need to do is add any of the following line to your code to make it work.

    // Any "one" of those two code section will work
    attachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
    attachment.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;

    Since .Net 4.0 is still in beta there will not be any hotfix for this until we hit the RTM and there is no official word on when this bug will be fixed.

    UPDATE – 7/20/2010

    We have an official fix and here is more information about it.

    http://blogs.msdn.com/b/vikas/archive/2010/07/21/hotfix-net-4-0-system-net-mail-unable-to-send-emails-with-large-attachments-more-than-3mb.aspx

    UPDATE - 7/21/2010

    If you prefer not to contact PSS, you can download the hotfix by yourself from the following link.

    http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226

    Happy Debugging!!!

  • Jive into Messaging world

    Did you like the makeover?

    • 0 Comments

    After couple of mails exchange with my earlier web hosting provider, I decided to save near 400 bucks for the images & other lots of junk data I had on my web hosting account. I decided to move my site to http://www.adhost.com/winisp who proudly hosted my website for FREE being a Microsoft Employee… yeah we do get all those perks :)

    So did you like the new look of my website.. please leave the comments on the new blog header image. I spent 200 hours on that image working through MSPAINT and then adjusting all the text together. Naahhh… I am lying. I found a wonderful tool to make cloud images from the Text - http://www.wordle.net. It let’s you create those wonderful images on the fly and even my kid can make them (if I had any), oh by the way I am still single ;)

    So, my life is little busy these days thus not able to write any new blogs but I have couple of topics in my mind. Lots of samples to blog but time is the constraint. I should be able to start writing more from February.

    Till then, happy reading and happy debugging!

  • Jive into Messaging world

    Blog Problem: Where are the images?

    • 0 Comments

    A very Happy New Year 2010 to you all.

    I had a really bad day while I was making some changes to my personal web hosting account with GoDaddy and accidentally canceled my web hosting account. With the immediate effect my website was no longer accessible and all the images/data hosted on the server is now 'inaccessible'... that's not a good start to the new year. Most of my blog posts had images hosted on my server and now they all are gone :-(. Even the site logo, to which I had put extra efforts is now gone.

    I spoke to GoDaddy and they are asking me to pay them 150 bucks to access my own data... grrrrr!!!!!

    Let's see if I am able to  get my data back, and the images as well for this blog.

    Happy Debugging!!!

     

  • Jive into Messaging world

    BUG: Outlook 2003: Custom Forms: You cannot use Custom Actions to Reply/Forward Appointment Items

    • 0 Comments

    I had been working on this issue lately where customer was using Outlook 2003 to create custom actions. It is not very commonly used thing so you might not know about it, at least I was not very much aware about it.

    To do that, you have to open a form in design mode and go to Actions tab, hit the New action button down in the bottom left corner.

    Give it the name of your choice and select “Appointment” type form from “Standard Forms” template. It will look something like this..

     

    Publish this form and send it to your self.

    Once sent, it will come up like this to your inbox, see the “CustomAction” button (this is the name that you provided)

     

     

    Once you click this button, it should open a new Appointment form like when you do a forward or reply button, but instead of doing that it shows an error.

    Error: "Could not complete the operation. One or more parameter values are not valid"

     

    I found this problem to be related with build number Outlook 2003 11.8313.xxxx (SP3) and it does not reproduce with the standard install of Outlook 2003 SP3 (build 11.8169.8172).

    So who caused it? Looks like that a latest security update has caused this issue.

    Security Update for Microsoft Office Outlook 2003 (KB973705)

    I have tried to uninstall this update and it started to work just fine, installed it back and it breaks again.

    Since Outlook 2003 is out of commercial support lifecycle, you may or may not get an hotfix for this. If you have a business justification and this issue is causing trouble to you then please do not hesitate to contact me.

    If we ever decide to fix it, then I will update this post and update you all.

    PS.: The only possible workaround, though highly not recommended, is to uninstall the security update but be aware of the risks of doing so.

    Happy Debugging!!!

  • Jive into Messaging world

    BUG: Outlook: Word: A signature to death!

    • 1 Comments

    I have been working lately with this customer who was trying to create new signature files under %APPDATA%\Microsoft\Signatures folder which will be used by Outlook 2007 (SP2) but what we discovered is that whenever they try to use it, it used to crash Outlook.

    This was the content of the HTML Signature file that we were using.

    <HTML>
    <BODY>
    <IMG SRC="http://www.server.com/logo.jpg" />
    </BODY>
    </HTML>

    Let’s save this HTML file to %APPDATA%\Microsoft\Signatures\CrashMe.htm

    Now next thing you need to do is make sure that Outlook’s Mail Format is HTML

     

    Next you need to make sure that “Typing replaces selected text” is unchecked under Tools->Options->Mail Format->Editor Options->Advanced

     

    Once you done it all, now we load a new email item and insert our signature into the body and just try to save the message, and it will crash the Outlook.

    Root Cause:

    I am not very much sure but its not Outlook’s fault at all, Outlook is just a victim and its Word libraries at fault which are used to Edit the email message.

    Workaround:

    Since there is no solution at this moment, here are your workarounds.

    1) Create the signature file using Outlook’s Signature Designer

    2) Do not use HTML as default format for emails, either use RTF or Text

    3) Do not uncheck the ‘Typing replaces selected text’ option, keep it selected

    The word team is working on it and I shall update you all when I have some more information on this.

    Happy Debugging.

  • Jive into Messaging world

    3 years of same, yet different work and then a responsibility upgrade, a good one.

    • 0 Comments

    It’s been 3 very long and cherished years of my life as I complete my 3 years of career at Microsoft India GTSC, based out of Bangalore, India.

    clip_image002A Bachelor in Computer Sciences was just a degree I acquired to certify my geek level. I was much more interested in practical knowledge than theoretical and decided to work a freelance along during my final years of graduation. After 4 years of working in different roles in IT industry,  as an independent consultant, system administrator , business analyst or software engineer, I got the opportunity to work with the Industry leader and decided to join Microsoft India GTSC & Developer Messaging Team in May 2006 as Support Engineer.

    Joining Microsoft was the beginning of my career in the real sense of the word, working with great minds & mentors brought me up to this level. Exchange has always been my favorite, seeing it grow from 5.5 to E14 and being part of this growth brings me immense pleasure. I am very excited to take up the role of Support Escalation Engineer and hoping to continue my legacy of providing the best and exceeding the limits.

    Happy Coding Debugging!!!

  • Jive into Messaging world

    Hey!!! Do not forget to “Include” me… Ok?

    • 0 Comments

    I am not talking about some Friday night dinner or the latest buff around the corner. I am talking about the “Include” tab on Outlook 2007’s Ribbon UI.

    Recently I got this case where customer developed a custom email form but he was not able to use the “Include” tab to add attachments to the email, as you can see from the following screenshot.

     

    All the buttons were grayed-out, but why? Customer had no clue, well that’s why he called Microsoft, isn’t it?

    I tried to reproduce it locally, but first I opened up the custom form which customer was using and the initial discovery was that there was no message body included to it. That ring some bells to me, but I ignored that for the moment and tried to dig if there is any property that I can set to disable that Include tab but there were none. I also checked if there was any code behind, but there was none.

    Now that I know what was present in form, and what was not, I decided to start from scratch and created a new form. And discovered the following.

    The issue here is that the customer has deleted the standard “Message” field (which is used to write the email content) from the message, this field is also used to insert attachments, business cards, calendar & other stuff by Outlook.

    Repro Steps
    
    1) Open a new email inspector
    2) Go to Developers Tab
    3) Hit Design Mode
    4) Delete the Message body
    5) Run the Form and you will see the “Include” as grayed out.

    Good now we know that was the culprit, but I do not need that message body on my form.. how do I fix it?

    Workaround
    
    1) We need to add the Message Body back to the form
    2) Open the form in Design Mode again and drag & drop the “Message” back to the form 
    3) Now you might not want that “Message Body” to be visible, but if you set the “Message Body” visible state
       to false then you will again not be able to add attachments as the body is not visible.
    4) Another workaround, you need to keep the visible state as visible but make body’s height & width set to 0 to hide it from screen

    Bingo!! That was it.. yeah now it works.

    ..but what a minute..why?

    Overall, that's a general design decision they made a long time ago. That first page of the message form has a lot of dependencies on commands, etc. So once you do a "simple" thing like delete the body control, you run some big risks. It's up to the form developer to really scope all of that out, disable other commands if they need to, etc.

    Happy Debugging!!!

  • Jive into Messaging world

    Using CDOSYS from .Net?! Be Careful with Attachments!

    • 0 Comments

    First off there is no justification why you should be using Cdosys directly, you should use System.Web.Mail if you are still on .Net 1.1 otherwise you should upgrade to System.Net.Mail.

    Anyways, the problem I want to mention is when you use CDOSYS.dll directly from .Net 1.1 or 2.0 or even 3.5, the problem is with memory management.

    Take this sample code..

    Function SendMail()
            Dim iMsg As New CDO.Message
            With iMsg
                .To = "test@server.com"
                .From = "test@server.com"
                .Subject = "Hello, This is a test mail !"
                .HTMLBody = "<b>Hi</b>, <i>This is a test <u>HTML</u> mail !</i>"
                .AddAttachment("d:\attachment.txt")
            End With
            iMsg = Nothing
    End Function

    Looks short and sweet like there is nothing wrong with this, think again!

    This code is holding the reference to File Handle and not going to release it even after you set iMsg = Nothing

    The solution here is to release the COM Object (CDOSYS) properly by calling GC.Collect() followed by GC.WaitForPendingFinalizers() but outside of this code block.

    Now consider this sample…

    Function SafeSendMail()
            SendMail()
            Gc.Collect()
            GC.WaitForPendingFinalizers()
    End Function
    
    Function SendMail()
            Dim iMsg As New CDO.Message
            With iMsg
                .To = "test@server.com"
                .From = "test@server.com"
                .Subject = "Hello, This is a test mail !"
                .HTMLBody = "<b>Hi</b>, <i>This is a test <u>HTML</u> mail !</i>"
                .AddAttachment("d:\attachment.txt")
            End With
            iMsg = Nothing
    End Function
    This will make sure that the CDOSYS is collected as soon as you leave the SendMail block otherwise you won’t be able to access the file for writing/deleting it.

    Happy Debugging!!!

  • Jive into Messaging world

    Exchange Web Services 101 : Let’s get started!

    • 6 Comments

    Want to learn Exchange Web Service but not sure how and from where? Here are the few articles that I share very often with partners and customers who want to learn more about Exchange Web Services.

    Undoubtedly there is so much information out there and that’s too in such a short span of time. You better start with Inside Exchange Web Services book from MSPRESS and then the rest of the articles can be utilized.

     

    MSPRESS BOOK

    • Inside Microsoft Exchange Web Services

    http://www.microsoft.com/learning/en/us/books/10724.aspx

    Note: This book target Exchange 2007 RTM and does not talk about features introduced in Exchange 2007 Sp1 & later

    • Common EWS Operations

    http://blogs.msdn.com/vikas/archive/2007/07/27/howto-getfolder-finditem-restriction-getitem.aspx

    • Working with attachments

    http://blogs.msdn.com/vikas/archive/2007/10/16/howto-ews-add-attachments-to-existing-items-on-server.aspx

    • Links on Common Exchange Web Services (EWS) Questions

    http://blogs.msdn.com/webdav_101/archive/2008/10/02/links-on-common-exchange-web-services-ews-questions.aspx

    • Generating list of calendar items using EWS

    http://blogs.msdn.com/webdav_101/archive/2009/01/10/sample-howto-display-a-list-of-calendar-items-in-listview-using-ews.aspx

    • Understanding and Fixing Slow Exchange Web Services Code

    Part 1

    http://blogs.msdn.com/mstehle/archive/2008/07/17/outbox-understanding-and-fixing-slow-exchange-web-services-code-part-1.aspx

    Part 2

    http://blogs.msdn.com/mstehle/archive/2008/08/13/outbox-understanding-and-fixing-slow-exchange-web-services-code-part-2.aspx

    Exchange Notifications

    • Exchange Web Services – Notification Subsystem

    http://blogs.msdn.com/vikas/archive/2007/08/28/ews-exchange-2007-notification-subsystem.aspx

    • Transitioning to Exchange Web Services Notifications (from Store Events Sinks)

    http://blogs.msdn.com/exchangedev/archive/2008/07/24/transitioning-to-exchange-web-services-notifications.aspx

    Note: Notification Watermarks are valid for 30 days after which they expire

    Exchange Managed API

    Videos –

    http://channel9.msdn.com/pdc2008/BB46/

    http://msexchangeteam.com/archive/2009/03/24/450892.aspx

    • Introducing the EWS Managed API 1.0

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

    • EWS Managed API 1.0 Beta SDK April 2009

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

    • Exchange Server Developer Center

    http://msdn.microsoft.com/en-us/exchange/default.aspx

     

    Please do let me know if that information is helpful to you.

  • Jive into Messaging world

    HOWTO: Automatically Login to OWA 2007 using HTML + JavaScript

    • 11 Comments

    First thing first, you should understand that this is NOT SUPPORTED & NOT RECOMMENDED solution by Microsoft.

    This is just a proof of concept that OWA 2007 can be auto login, if you know the username & password of target account.

    The approach is simple and took me little reverse engineering or OWA’s login page. Owa login page being HTML does a form submit and post the username/password along with few hidden variables and upon receiving those parameters owaauth.dll generate a cookie, assign it to the session and redirect you to your mailbox. How easy, you may say.. but how you can submit those parameters programmatically.

    This is how its done…

    <script>
    function LoginToOWA (server,domain,username,password) {
      
      
      var url = "https://" + server + "/exchweb/bin/auth/owaauth.dll";
      var p = {destination:'https://' + server + '/exchange',flags:'0',forcedownlevel:'0',trusted:'0',isutf8:'1',username:domain + '\\' + username,password:password};
      
      
      var myForm = document.createElement("form");
      myForm.method="post" ;
      myForm.action = url ;
    
      for (var k in p) {
      
        var myInput = document.createElement("input") ;
        myInput.setAttribute("name", k) ;
        myInput.setAttribute("value", p[k]);
        myForm.appendChild(myInput) ;
      }
        
      
      document.body.appendChild(myForm) ;
      myForm.submit() ;
      document.body.removeChild(myForm) ;
    }
    </script>
    
    <body onload="javascript:LoginToOWA('owa.exchange.com','domain','username','password');">
    <h3>Please wait while redirecting to OWA...</h3>
    </Body>
    Happy Coding!!!
     
    Share this post :
  • Jive into Messaging world

    HOWTO: EWS: Get OOF State for Self or any user in your organization

    • 4 Comments

    First thing first, this is just for demonstration purpose and might *not* be a supported solution by Microsoft. The setting we are reading from are hidden messages and not documented anywhere. I had to reverse engineer it for demonstration purpose.

    Objective: To get OOF State of any user in your organization.

    Challenges: You might ask me why not use GetUserOofSettings to query user’s OOF status with the help of Exchange Impersonation? This is due to the limitation of EWS’s GetUserOofSettings/SetUserOofSettings methods as they don’t support Impersonation.

    Workaround: Directly reading the hidden messages from Mailbox Root where this Flag & OOF message is stored. Since we are read-only we should be good to do so, that’s my assumption.

    We need to first make a FindItem call to the mailbox root and search for a message with ItemClass = “IPM.Microsoft.OOF.UserOOFSettings”. Assuming that there will be only one message with that message class at any given time, we get its ItemId and make a GetItem call to read the message body. The message body is plain text XML with following structure

     

    For OOF enabled…

    <UserOofSettings>
    <OofState >Enabled</OofState>
    </UserOofSettings>

    For OOF disabled…

    <UserOofSettings>
    <OofState >Disabled</OofState>
    </UserOofSettings>

    There is also a state called SCHEDULED, please refer to the below mentioned article to know more about it

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

    This code sample can do the job for you.

    using System;
    using GetOOFState.MyEWS;
    
    namespace GetOOFState
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                
                ExchangeServiceBinding esb = new ExchangeServiceBinding();
                esb.Url = "https://server/ews/exchange.asmx";
                esb.Credentials = new System.Net.NetworkCredential("ServiceAccount", Password", "Domain");
    
                esb.ExchangeImpersonation = new ExchangeImpersonationType();
                esb.ExchangeImpersonation.ConnectingSID = new ConnectingSIDType();
                esb.ExchangeImpersonation.ConnectingSID.PrimarySmtpAddress = "username@domain.com";
                
    
                FindItemType fit = new FindItemType();
                fit.ItemShape = new ItemResponseShapeType();
                fit.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
                fit.Restriction = new RestrictionType();
    
                IsEqualToType itemMessageClass = new IsEqualToType();
                
                PathToUnindexedFieldType msgClassProp = new PathToUnindexedFieldType();
                msgClassProp.FieldURI = UnindexedFieldURIType.itemItemClass;
    
                ConstantValueType msgClassValue = new ConstantValueType();
                msgClassValue.Value = "IPM.Microsoft.OOF.UserOOFSettings";
    
                itemMessageClass.Item = msgClassProp;
                itemMessageClass.FieldURIOrConstant = new FieldURIOrConstantType();
                itemMessageClass.FieldURIOrConstant.Item = msgClassValue;
                
                
                fit.Restriction = new RestrictionType();
                fit.Restriction.Item = itemMessageClass;
    
                DistinguishedFolderIdType rootFolder = new DistinguishedFolderIdType();
                rootFolder.Id = DistinguishedFolderIdNameType.root;
    
                fit.ParentFolderIds = new BaseFolderIdType[] { rootFolder };
    
                FindItemResponseType firt = esb.FindItem(fit);
                string itemID = ((ArrayOfRealItemsType)((FindItemResponseMessageType)firt.ResponseMessages.Items[0]).RootFolder.Item).Items[0].ItemId.Id;
    
                GetItemType git = new GetItemType();
                ItemIdType iit = new ItemIdType();
                iit.Id = itemID;
    
                git.ItemIds = new BaseItemIdType[] { iit };
    
                git.ItemShape = new ItemResponseShapeType();
                git.ItemShape.BaseShape = DefaultShapeNamesType.IdOnly;
    
                PathToUnindexedFieldType []propsToFetch = new PathToUnindexedFieldType[1];
                propsToFetch[0] = new PathToUnindexedFieldType();
                propsToFetch[0].FieldURI = UnindexedFieldURIType.itemBody;
    
                git.ItemShape.AdditionalProperties = propsToFetch;
                
       
    
                GetItemResponseType girt = esb.GetItem(git);
                ItemType itemOOF = ((ItemType)(((ItemInfoResponseMessageType)girt.ResponseMessages.Items[0]).Items.Items[0]));
    
                System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
                xDoc.LoadXml(itemOOF.Body.Value);
                Console.WriteLine("OOF State: {0}", xDoc.GetElementsByTagName("OofState")[0].InnerText);
                
    
                
    
            }
        }
    }

    Happy Coding!!!

Page 1 of 4 (87 items) 1234