Authentication with SharePoint Online

Hi
I have a win32 C++ application which is able, using NTLM authentication, to call the different SharePoint web services (lists, copy, etc) in a local SharePoint installation. This is done by building XML SOAP requests at runtime and HTTP posting.
This approach does not work with SharePoint Online and I was wondering if it was possible to make the existing code work without a total rewrite.
I have experience with OAuth 2 as I have previously integrated to OneDrive, Google Drive, Dropbox etc. using their REST web service api.
Is it also possible to use OAuth 2 with SharePoint Online and the web services in a similar fashion? Have refresh tokens and exchanging them for access tokens which are sent to server in post.
I have tried playing around with it, creating an app in the Microsoft Seller Dashboard and tried using client id with OAuthAuthorize.aspx, but getting error 'The clientId 'xxx'
is not a valid service identity.". No idea what that means.
Am I going the wrong way and can someone point me in the right direction?
Thanks!

Hi,
In order to access SharePoint Online via REST API, we can use SharePointOnlineCredentials object to pass the authentication.
Here’s a code sample that connects to the REST API:
var creds = new SharePointOnlineCredentials(SPO_USERNAME, StringUtilities.ToSecureString(SPO_PASSWORD));
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(SPO_URL + "/_api/web/lists");
request.Credentials = creds;
request.Method = "GET";
request.Accept = "application/json;odata=verbose";
request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED: f");
var response = (HttpWebResponse)request.GetResponse();
using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
Console.WriteLine(reader.ReadToEnd());
More information:
http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.sharepointonlinecredentials(v=office.15).aspx
http://sharepointtaproom.com/2014/01/23/connecting-to-sharepoint-onlines-csom-or-rest-apis-from-sharepoint-2010/
http://sergeluca.wordpress.com/2009/08/31/calling-sharepoint-dlls-from-c-code/
Best regards
Dennis Guo
TechNet Community Support

Similar Messages

  • Error in Application.Run(DisplayLoginForm) and Remote Authentication in SharePoint Online Using the Client Object Model

    Hi guys
    I Think that is a simple error, but I don’t have enough knowledge in .NET apps.
    I make an console app that use Remote Authentication in SharePoint Online Using the Client Object Model, that a I downloaded from MSDN.
    This App run ok.
    But when I like to make a Windows From App. This component send me an error in Application.Run(DisplayLoginForm)
    This err msg :
     An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
    Additional information: Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead.
    Is there any way to use a form inside a windows form?
    Thank in advance
    Ramiro
    Ramiro B

    Hi,
    Based on the error message, please do as following:
    1. Check your code logic below:
    void btn_Click(object sender, System.EventArgs e)
    Thread t = new Thread(StartMyForm);
    t.TrySetApartmentState(ApartmentState.STA);
    t.Start();
    public static void StartMyForm()
    Application.Run(new MyForm(..));
    2.Try to add the following code line in your code.
    Application.Restart();
    If the issue still exists, please provide your requirement and code for a further research.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Multitenant application authentication in SharePoint Online (O365)

    I am able to use OAuth2 to authenticate using the mechanism described here: http://msdn.microsoft.com/en-us/library/azure/dn645542.aspx - my intention is to allow my 3rd party WebApp to allow users to grant access to their SharePoint content via Azure OAuth.
    I am able to use the login.windows.net/common/oauth2 endpoints, and having registered my app in Azure, I do indeed get the right callback once the user authentiates, and I am able to post to the token endpoint.
    At this point, I have an auth-token that I can use, but I don't know the URL to the user's default (or root) SharePoint site. I am required to provide a 'resource' URI so that authentication can succeed, and if I hard-code this value to a known URL, then
    it works like a charm.  Unfortunately, this makes my application specific to one particular tenant.  Far from ideal...
    My question is - how can I detect the SharePoint URL to use as the resource parameter for access to - before the user logs-in? Or even better - is there a way to login using OAuth2 that allows me access to SharePoint endpoints, but which does not require
    me to know what the endpoints are ahead of time?
    If not, I don't see how it is possible to write multi-tenant applications with this model. I must be missing something.   Help!

    There are some interesting details on the stack overflow post here: http://stackoverflow.com/questions/27303590/building-a-multi-tenant-app-for-sharepoint-online-o365
    Bottom Line : SharePoint Online O365 applications only seem to be viable with hard-coded tenancy URLs - and there does not seem to be a mechanism for discovering a user's root web or site by the time it is required. This seems like a major hole in the multi-tenant
    application architecture, or more correctly the Azure login procedure for SharePoint, which has implications on a multi-tenant application.
    I am hoping someone has the magic silver bullet out there...

  • Is Office Home and Business 2013 fully compatible with Sharepoint Online (Office 365)?

    My client recently upgraded 3 Windows 7 PCs (2-32 & 1-64-bit OS) from Office 2007 32-bit (which was actually working fine against Exchange/SharePoint Online) to Office Home and Business 2013 (32-bit)
    Now, for all 3 PCs, while Office 2013 Word/Excel can open, check out/in, and save SharePoint Online files, there is ALWAYS a 2 minute delay in closing the file which is apparently waiting for the Local Security Authority call to return. This seems
    to indicate an issue related to SharePoint security on the client side.
      Problem Event Name: AppHangXProcB1
      Application Name:        
    WINWORD.EXE
      Application Version:    
    15.0.4657.1000
      Waiting on Application Name: 
    lsass.exe:lsasspirpc
    This is the Local Security Authority Security Support Provider Interface Remote Procedure Call (LSA SSPI RPC)
    My client has 66 licenses for SharePoint Online (Plan 2) and 73 Exchange Online (Plan 1) "stand alone" services. The same failure is happening on 3 Win 7 PCs. All of which I've carefully reviewed against the MS Office trouble shooting guides (start
    Windows OS w/out non-MS services, Word/Excel safe mode w/out add-ons, O365 readiness checks, Office repair, etc.). We have PCs running Win 7 (32 & 64-bit) w/Office 365 ProPlus & Office Professional Plus 2013 that work fine. it's JUST these 3 Win 7
    PCs that were upgraded from Office 2007 to Office Home and Business 2013 that have the 2 min. SharePoint file close time.
    Can you please confirm that Office Home and Business 2013 is compatible w/SharePoint Online
    at least for Excel and Word?
    The "slow close" problem can be demonstrated on multiple site collections/sub sites and w/Excel & Word docs in doc libs and lists
    After many hours capturing information, following the MS Office trouble shooting guides, and repairing the Office install, I've had no luck in resolving this.While Word/Excel will eventually close SharePoint Online files after about
    2 minutes, this is certainly unacceptable. Otherwise, locally stored files close normally and new files were created by the Office 2013 Excel/Word for this testing.
    Any thoughts or guidance would be appreciated.  

    Hi raygabe,
    I couldn't find the document mentioned there is any compatibility between Office365 SharePoint online and Office Home and Business 2013 version, I would recommend that you check if the issue could be reproduced on other Win7 machines installed with Office
    Home and Business 2013 installed directly instead of upgrading from Office2007, see if issue is related to Office application upgrade.
    I also recommend that you post this issue on our dedicated Office365 SharePoint online forum and Office 2013 forum for a better assistance with more experts regarding this issue from the following links.
    http://community.office365.com/en-us/f/154.aspx
    https://social.technet.microsoft.com/Forums/office/en-us/home?category=officeitpro
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • RDP Users seeing display issues with SharePoint Online Template

    I originally posted this in the SharePoint Online forums, but they referred me to the RDP forums as it appears to be an issue with RDP, not SharePoint Online: Original
    Post
    I've been able to verify this only happens in RDP when opening a Word Template with embedded Excel table  from SharePoint Online within the local Word 2010 application.

    Amy,
    Thank you for the input.  Its rather odd, but it appears the users who are seeing this problem are connecting via RDP on laptops with widescreens, with screen resolution set much higher than the 1290x1084 we use on the terminal servers.  Turning
    the resolution down on the laptops did keep the table from becoming oversized and most of it running off edge of document.
    However, it appears even turning down the resolution of the client machine still affects how the font is displayed in the document. The font size and type are different than the template document, they get saved that way and appear that way to other users
    who do have their screen resolution set correctly.   It seems there is something else going on here, thoughts?

  • Convert Word documents to PDF with SharePoint Online 2013 - C#

    We have a client with a requirement to automatically create a PDF copy of a Word document when the Word doc hits a major version.
    I am aware there are third party apps for this, but we'd prefer to develop this ourselves.
    Word Automation Services is not available in SharePoint Online, so we do not have that option.
    We'd prefer not to use Microsoft.Office.Interop.Word as we'd then need a client running with MS Word.
    It would seem like the CSOM Microsoft.SharePoint.Client would be able to do this somehow.  I'd imagine that's how the third party apps are accomplishing this.  However I'm not seeing specifically how to save to PDF via CSOM.
    Can anyone provide insight on how to accomplish this programatically?
    Thanks

    Hi Mr. Craig,
    you can create provider hosted app and use the below thread
    https://social.msdn.microsoft.com/Forums/office/en-US/40b2ee36-13c9-420d-a6b5-3ec5f42b09d7/converting-docx-to-pdf
    Please let me know if this is helpful
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation

  • Pairing Workflow Manager with SharePoint Online

    Hi everyone,
    I found
    this post by Adis Jugo and I wondered if this is (or maybe is planned to be) supported in SharePoint Online?
    I created custom code activity, used it in workflow (sharepoint app) and it works on SP 2013. What I want to do, if it is possible ofc, is to use the same sharepoint app in SP Online.. 
    This is the tutorial which was followed to create Workflow CodeActivity..

    Hi Mahesh,
    According to your description, my understanding is that you got an error when you register workflow manager for SharePoint 2013.
    Firstly, please check whether you install SharePoint Developer tools Preview for VS 12. If yes, please uninstall it , and restart the server, then run Register-SPWorkflowService.
    If this issue still exists, go to Central Administration, and check whether the web application is connected to Workflow service application proxy.
    Here are some similar posts for you to take a look at:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/dcb16362-d93c-4f05-b0ba-7b4519caa541/sharepoint-2013-workflow-manager-error-when-i-register-workflow-service?forum=sharepointadmin
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/f1482967-cd0f-4509-aa85-36ed4ba6e07d/error-during-register-workflow-service-2013?forum=sharepointadmin
    http://sharepointdeal.wordpress.com/2013/07/08/register-spworkflowservice-failed-to-query-the-oauth-s2s-metadata-error/
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • EchoSign integration with SharePoint online

    Does anyone know if there is integration between SharePoint online and Adobe EchoSign as I have to demonstrate the use of EchoSign within an office 365 SharePoint environment.
    The only installation guide I can find is specific to an on-premises deployment.

    There is a DocuSign integration for SharePoint Online, if you are still in the process of deciding which vendor to use.
    Mike Borozdin - DocuSign

  • Project Pro 2013 and syncing with SharePoint Online 2013 (Office 365)

    Good day,
    I am experiencing some challenges with a Project Pro master project file and syncing to SharePoint 2013 (Office 365).
    What works
    Individual projects can be synced to SharePoint without issue. Once synced, the site start page presents the Project Summary gant, clicking the Tasks link takes me to the tasks. Project files are stored in the Site Assets directory in each SharePoint site
    (one site per project file).
    What doesn't work
    When I create a new project (and sync it to a new site), then add two (2) existing project files that reside on SharePoint and then sync to the new master project site I
    don't see any content in the Project Summary gant, nor do I see any tasks in the task list. I can't figure out if this is not supported or if I've done something wrong. There are no error messages or indicators that I've done something wrong,
    short of the master project projects not showing up on the master project site (nothing in the project summary gant and no tasks).
    Some help would be greatly appreciated. Being able to render a master project is crucial to understanding timelines for many projects in a single view.

    Steven,
    This is by design. Inserted Sub projects will NOT show in the Master Project Tasks list. You will only see tasks inserted directly at the Master Project Level.
    Moreover, if you set up a dependency between Master project Task and Subproject task, then the sync will not work. All in all, there are limitations for this process, which is where Project Online/Project Server needs to be considered.
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • Project File Sync with SharePoint online across time zones

    We have a Project file that we have synced with an 0365 SharePoint site.  The project teams are working in US Central Time and Vladivostok Russia.  The original Project file is set up in Vladivostok time.  Users see the SharePoint Task Dates
    in their local time.  However, when the project manager opens the file in Central Time Zone, the project file automatically reschedules start dates that are on Monday in Vladivostok (which start on Sunday in US Central Time) to non-weekend US Days and
    then updates the SharePoint Tasks.  If the project manager in Vladivostok opens the file, more auto-scheduling occurs to move Start Dates to non-weekends in Vladivostok.
    Is there anything we can do to avoid the auto-rescheduling based on the time zones that will not affect the file if we need to change the Start and Due Dates due to late starts?
    Kim Frehe

    The level of sophistication that synchronizing to a SharePoint site is minimalistic. This is a very simple collaboration scheme. AFAIK, there is nothing you can do other than to all play in the same time zone, or at least pretend to by observing the offset.
    For international collaboration, Project Online would be your best answer. I suggest that you request a 30-day trial, which you can obtain from a Gold partner such as my company.
    Gary Chefetz, MCITP, MCP, MVP msProjectExperts
    Project and Project ServerFAQs
    Project Server Help BLOG

  • How to add a form to a public site with sharepoint online 2013 (plan2)

    We need to add a form to a public site: in particular a form where candidates can apply submitting some info and sending a file (cv).
    What would you recommend to use?
    Thank you,
    ER

    No, our Sharepoint is not bundled in any of office 365 subscriptions.
    It's a simple SPO Plan 2 subscription.
    I don't know if it makes any difference though.

  • Sharepoint Client Context Retrieval From a Web app authenticated with Ping Federate

    Hi All,
    We are developing a WCF which would read value from a SharePoint list where web application only has Ping Federate authentication in all Zones. We have to use client object model since WCF would be hosted in a different server.We are not able to get data as
    when clientContext.ExecuteQuery(); is called it throws forbidden error. We have followed the below blog http://travisspencer.com/blog/2010/03/getting-a-token-from-pingfeder.html how ever  we are getting reply <faultstring>Unable to determine partner
    SP connection by AppliesTo: url</faultstring>. While we are calling the using the below blog were getting forbidden error at _layouts/authenticate.aspx itself. 
     http://fredericloud.com/2011/01/11/connecting-to-sharepoint-with-claims-authentication/
    Please let le me know if you have any working examples or documents regarding the same. 
    Thanks & Regards, Balu

    Hi,
    Does the account in use has the permission to access the SharePoint list? By default, we will come across the “Access Denied” if the current account has no access to a SharePoint
    object.
    For the authentication issue with SharePoint Client Object Model, you can try to set the credential to ClientContext object with the help of
    NetworkCredential Class.
    More information about authentication with SharePoint Client Object Model:
    http://bramdejager.wordpress.com/2013/08/02/using-csom-and-powershell-to-query-sharepoint-online-or-on-premise/
    http://sharepointdragons.com/2012/04/20/authentication-when-using-the-sharepoint-client-object-model/
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • Data Connection to PowerPivot Workbook on Sharepoint Online

    Hi, we have an on-premise Sharepoint environment where we publish PowerPivot workbooks that serve as the source database for pivottables in other Excel workbooks.  Is there a way to do something similar with Sharepoint Online where we would upload
    a PowerPivot workbook to Sharepoint Online and use as the source database for the pivottables in other Excel workbooks?  Whenever I try to connect to the PowerPivot workbooks on Sharepoint Online, I get a prompt saying that access is Forbidden.
    Appreciate the help!

    Hi, we have an on-premise Sharepoint environment where we publish PowerPivot workbooks that serve as the source database for pivottables in other Excel workbooks.  Is there a way to do something similar with Sharepoint Online where we would upload
    a PowerPivot workbook to Sharepoint Online and use as the source database for the pivottables in other Excel workbooks?  Whenever I try to connect to the PowerPivot workbooks on Sharepoint Online, I get a prompt saying that access is Forbidden.
    Appreciate the help!

  • Clarification on SharePoint Online and SQL Server

    I have several subsites on a SharePoint 2013 server that uses external content types and the Business Data Connectivity Service to access tables in a SQL Server database. I used the Sharepoint 2013 Designer to configure most of this, but at times, I also
    used Visual Studio 2013. Everything works fine. It successfully uses a secure store Application ID to authenticate connections to a remote SQL Server (i.e. the SQL Server and SharePoint server are 2 completely different machines that are not even within the
    same domain). The external lists on the SharePoint site are capable of reading data in the SQL tables, updating data, adding new data, and deleting old data. I have specified permissions to users/groups that help me control who can access the external lists
    on the SharePoint sites. Everything has been working well for a while now.
    But now I have to start thinking about using SharePoint Online, instead of an on-premises SharePoint server. And everything I am reading indicates that what I do above is not going to work with SharePoint Online. It sounds like I will have to either move
    our database to a SQL Azure service, or if I want to continue using our existing SQL Server, then I am going to have to develop a WCF service that will allow SharePoint Online to communicate with our own SQL Server. Am I understanding this correctly? Or is
    there a way to take what I did above and make it work with SharePoint Online?
    Thank you,
    Steven

    Hi,
    We can use Hybrid Connections to connect SharePoint Online to an on-premises SQL Server.
    Here is a blog from MSDN for your reference:
    http://blogs.msdn.com/b/alimaz/archive/2014/07/31/connect-sharepoint-online-to-an-on-premises-sql-server-from-an-azure-provider-hosted-app-using-hybrid-connections.aspx
    We can also customize a WCF service and publish it to public web site to achieve it.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Building Site Collections in SharePoint Online

    Hello all,
    Please forgive me for this very basic question, but I was not able to find the info online. 
    Background info: I have a great deal of experience with SharePoint administration on-prem but not much experience with SharePoint Online. My current organization has O365 and wants to build a collaboration environment and an Intranet. I understand the information
    architecture practices that would have been common for this for an on-prem environment, and I understand that those have changed with 2013 and SharePoint Online due to the new practice of organizing everything under one web app. 
    Between reading some articles and using my experience with on-prem, I am trying to design an organized information architecture that will facilitate both environments and the permissions structures they require. My tentative plan was to build one site collection
    for the Intranet under https://mycompany.sharepoint.com/sites (under which subsites would be built for various Intranet divisions), and then a number of individual site collections for the collaboration environment under https://mycompany.sharepoint.com/teams
    (/hr, /finance, etc., so that content owners and users could work in their own site collection without affecting a site collection belonging to someone else). 
    This is the article that initially caused me to believe that this is possible/a good idea: http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2014/09/01/sharepoint-online-information-architecture-considerations.aspx. 
    "For [managed paths] you get the root, /search (explicit managed path), /sites (wildcard managed path), and /teams (wildcard managed path)."
    However this article leads me to believe that I will not be allowed to create any site collections at all, only subsites: https://support.office.com/en-us/article/Plan-sites-and-manage-users-8e568d8d-3d65-42c4-99fa-f7285c9db842. 
    "You cannot create additional site collections in SharePoint Online for Office 365 for Small Business."
    I understand the answer to this may depend on what version of O365 we have, and I am working to find that out. 
    My understanding is that I cannot be made a SharePoint Online administrator without being a global O365 administrator: http://blogs.technet.com/b/lystavlen/archive/2012/06/14/understanding-the-administrator-role-in-sharepoint-online.aspx.
    "You cannot separate the roles of Office 365 global administrator and SharePoint Online Administrator." 
    Thus, I don't currently have the level of access I need to browse around the administration area and find the answers to my questions that way. When the time comes, I will likely be given temporary access or will be working with an O365 global administrator
    to build.
    Main question: Will I be allowed to build site collections under managed paths?
    Larger question: How are others managing the information architecture for an Intranet and a Collaboration environment in SharePoint Online, especially if the answer to the prior question is no?
    Thanks in advance for any insight you can offer. 
    Shae

    Hi,
    According to the error message, the Microsoft.Online.SharePoint.Client.Tenant.dll seems not been loaded.
    You can find it in the path below:
    C:\Program Files\SharePoint Client Components\Assemblies
    A code snippet about how to retrieve a list of site collections in a tenant for your reference:
    const string username = "[email protected]";
    const string password = "password";
    const string tenantAdminUrl = "https://yourdomain-admin.sharepoint.com/";
    var securedPassword = new SecureString();
    foreach (var c in password.ToCharArray()) securedPassword.AppendChar(c);
    var credentials = new SharePointOnlineCredentials(username, securedPassword);
    using (var context = new ClientContext(tenantAdminUrl))
    context.Credentials = credentials;
    var tenant = new Tenant(context);
    SPOSitePropertiesEnumerable spp = tenant.GetSiteProperties(0, true);
    context.Load(spp);
    context.ExecuteQuery();
    foreach (SiteProperties sp in spp)
    Console.WriteLine(sp.Title);
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • GeoRaster in the Enterprise - tips?

    Next week I will start a pilot project loading mid to high resolution (0.5M to 0.1M) orthophotos for about 200 sites around 13000 hectares (50 Sq Mi) each. The sites are for the most part not contiguous, but the data is global. The source format is m

  • Passing Dynamic Loop Data From Child Page To Parent

    Hi All,      I'm trying to create something where when a user clicks a link on the main page, javascript opens a new window which querys a database and displays the results.  The user then selects the result they want via a form button or url (doesn'

  • Camera RAW ruining JPEGS, cant disable

    I have CS3. Certain jpeg files now ONLY open with Camera Raw in PS, no matter what I do. I just want to open them regularly, but I cant get ACR to go away, and ACR is corrupting the color somehow when it opens them this way. Under preferences, (in bo

  • OID and binding java serialized object

    Hi there, How are you doing? I am trying to bind a serialized java object to a name in Oracle Internet Diectory (oid) using JNDI. it gives me an errror. "OperationNotSupported LDAPA error 53: Unwilling to perform: I have directory manager 2.1.1 and J

  • Error while starting OC4J

    Hi, I have installed OBIEE 10.1.3.4 and tried to start OC4j but i am getting the below error: Can someone help me in solving this error. 2009-11-05 13:32:57.045 ERROR ServerFile[PersistentMap,/C:/oracle/bise1/bi/oc4j_ bi/j2ee/home/persistence/jms.sta