Logon Failure: The target account name is incorrect while connecting to exchange RRS feed

  • Question

  • Hi,

    I have a custom sharepoint timer job that pulls the emails of a specific user acoount and adds to a SharePoint list. Earlier it used to work fine by pulling all the emails.

    Now, there has been a change in Excahnge OWA Url,  so I changed that Url in the code and when I do debugging it is throwing me an error:

    "Unable to automatically step into the server, Connecting to the server machine '' failed. Logon Failure: The target account name is incorrect."

    I don't know where to look at. Can anybody please suggest me where I need to look and fix it?

    Thank you very much in advance.

    Thanks, Hitchs

    • Changed type Hitchs Monday, October 22, 2012 7:41 PM
    Monday, October 22, 2012 7:39 PM

All replies

  •  What API are you using ? If you using EWS then you shouldn't be using the OWA URL (well not the full thing anyway). You should be really using Autodiscover rather then hard coding URL's to cater for this type of issue where the CAS URL will change and your code will break see

     Also if you select okay can you continue debugging ? If your using Proxy code it maybe just that its trying to connect to the EWS endpoint to continue debugging which will always fail but you should just be able continue through this error.


    Tuesday, October 23, 2012 6:14 AM
  • Hi Glen,

    Thanks for your reply and reference. is the Url I'm using.

    If I select OK, I'm able to continue but it is leading to the Catch block with exception "Object refernce not set to an instance.." after that error which I showed you in my first reply. After this, the rest of the code is executing normally, but it is not pulling any emails from the inbox to the target list.

    In timerjobs, the status of that job shows Succeeded.

    Is there anything I need to check? and is there any special way to debug this application?

    Thanks, Hitchs

    Tuesday, October 23, 2012 5:17 PM
  • I would suggest you use the EWSEditor to test your URL actually works and you can also use this to test the functionality of EWS in general.

    "Object reference not set to an instance.." this error generally points to one of the objects being null in your code you should be able to check this in a debugger before you get the error. But it could also indicate the response that EWS is sending back isn't valid the EWSEditor should be able to tell you that.

    If you don't get the correct response from EWS check this its an old bug but if your Service Pack/Patching is not updated it could be the cause.


    Tuesday, October 23, 2012 11:37 PM