SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to have a console app that can login in, authenticate and update some custom lists. I can't find any good examples that work.

share|improve this question
up vote 2 down vote accepted

The only tricky part for accessing SharePoint Online from the Client Object Model will be the authentication. There is no direct method of authenticating with SharePoint Online from the CSOM so Microsoft has released a work around.

You can find the details and code here:

So what it basically does is:

  1. Opens up a browser Instance

  2. Authenticates with the browser

  3. Grabs the authentication cookie and passes it to the Client Object Model.

The rest of the tasks should be quite straight forward. You can find many code samples here:

UPDATE: You this technique to allow the authentication to happen without a human running the console app:

share|improve this answer
Where would I specify the login/password? I don't see that in the example. It gets through the process, but then gives me a 403 Access is denied. I'm assuming because it's not authenticated properly. Thanks! – Shane Nov 7 '12 at 15:09
Did you check the first link for the authentication sample? See here for direct jump to the page:… – Vardhaman Deshpande Nov 7 '12 at 16:11
Yes, that is what I am using. Does the window that it puts up supposed to be where you manually login? Is that how it gets it? Mine just opens really fast then closes, but still. If this requires user interactivity, then this won't work. – Shane Nov 7 '12 at 16:25
Yes you will have to login if you are not already authenticated with Internet Explorer. Once you log in, the cookie will be saved and you wont have to login again till it expires. My guess is that you are already logged in with a different account in IE and that's why the window is closing fast and you are getting the access denied error. – Vardhaman Deshpande Nov 7 '12 at 16:32
so for this technique to work, you have to have a user logging in? Is there no way to authenticate with SP remotely with a nightly job. I just want to keep a custom list in sync with a SQL table. – Shane Nov 7 '12 at 16:39

If you will be running this console app on the SharePoint server then use the SharePoint Object Model.

On the other hand, if this app will be accessing SharePoint remotely then use CSOM. For information about how to use CSOM, see the following MS Pattern & Practices article.

Basically, the way CSOM works is:

  1. Create a context by specifying the SharePoint site.
  2. Create a query.
  3. Execute the query. Which will send that query to the SP server (more specifically to the client.svc), execute the query, and return the result back to you.
share|improve this answer
This is SP 2010 online, so it wil be remote, not on that server. – Shane Nov 6 '12 at 21:29
Then, in that case use CSOM. – Hossein Aarabi Nov 6 '12 at 21:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.