Hot answers tagged

10

Just add the NuGet package AppForSharePointOnlineWebToolkit. It will add the TokenHelper.cs and SharePointContext.cs files to your project.


9

You will have to have the user redirect back to the Office 365 site again to get a new refresh token. I had worked with MS on a project I was working on for my employer and they had indicated this to me. The unfortunate part is that the only real documentation that even says its 6 months is here: http://msdn.microsoft.com/en-us/library/jj687470.aspx. It ...


8

It depends heavily on your requirements and on the app type you are going to build (web application or just console daemon, azure function, etc.). Does it require user context or not? Here are the options available: Create Azure AD application, give required permissions to SharePoint and use node-adal library for OAuth (authorization code flow, client ...


6

Well as for me you can always register the app for the first time on one of the tenants, use the registration data in Azure and in .app file and then, when installing the app on other tenants instead of clicking on generate button in appregnew.aspx, simply paste the client id and client secret you have generated when installing the app for the first time. ...


5

Just regenerate the token. Add the App For SharePoint nuget package to your console app. Install-Package AppForSharePointWebToolkit Then write the code to generate the token and context object. Uri siteUri = new Uri(siteUrl); string realm = TokenHelper.GetRealmFromTargetUrl(siteUri); string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper....


5

I was finally able to figure out what I was doing wrong: 1) The Authorization Code returned when creating the OAuth connection is only good for that browser session. Thus why I couldn't reuse that authorization code later in back end services or in new browser sessions. 2) On the redirect page, I used the Authorization Code returned to create a new Access ...


4

Make Sure that you installed Office developer Tools and SharePoint Server 2013 Client Components SDK We don't need any external Reference for the SharePointContext.cs and TokenHelper.cs files. Once we create the provider hosted app, they will come in the VS Web Project automatically. If they are not present in the Provider hosted app Web ...


3

From a home/personal Office 365 stand point, yes it would be similar to any other internet service that if your password is compromised, then someone can get into your tenant. However, any business that is using Office 365 is highly likely to be synchronizing objects from local Active Directory to SharePoint, and therefore you are using auth credentials ...


3

Having learned a fair bit about OAuth in Office 365 since I posted the question, I can now answer myself: No, you cannot use OAuth without an app. However, in on-premise solutions you can set up a High Trust server to communicate without having to use OAuth at all.


3

To solve this issue I had to edit the AppManifest.xml file under <AppPrincipal> <AppPrincipal> <Internal /> <!--<RemoteWebApplication ClientId="*" />--> </AppPrincipal> had the result that Visual Studio did not update the ClientID anymore when debugging. I changed it to <AppPrincipal> <!--<Internal ...


3

First of all now SharePoint Apps are changing to SharePoint Add-ins. See here. And the answer to your question is to broad in context. We can just help you by providing the links. SharePoint Add-ins are self-contained extensions of SharePoint websites that you create, and that run without custom code on the SharePoint server. If you need to know about ...


2

As of this moment, access to SharePoint endpoint via Graph API is possible only through the beta endpoint. Your URL should be as below: https://graph.microsoft.com/beta/sites/tenantname.sharepoint.com/lists Make a normal GET call to the above endpoint, the output would be as below: Reference - Working with SharePoint sites in Microsoft Graph To access ...


2

Evantually we successfully used the URL Rewrite module, evaluating and inserting CORS headers when requests come in. This is happening outside SharePoint, as part of IIS request processing.


2

As far as I tested, there's definitely no problem in mixing JavaScript Object Model and C# client Object Model. Your provider-hosted app is like a SharePoint-hosted app (JavaScript OM) + a third-party server that can use C# client OM with oAuth authentication. Both worlds won't interfere. However, as often, there's a little maintenance problem: you ...


2

I have found answer on official MSDN documentation How to: Replace an expiring client secret in an app for SharePoint Client secrets for apps for SharePoint that are registered using the AppRegNew.aspx page expire after one year. This article explains how to add a new secret for the app.


2

A user must have the Manage Web site and Create Subsites permissions to add an app for SharePoint. By default, these permissions are available only to users who have the Full Control permission level or who are in the site Owners group. http://technet.microsoft.com/en-us/library/fp161231(v=office.15).aspx This (I believe) is because the installation ...


1

As per my understanding, you are asking about Single sign on (SSO) and one way to achieve that is ADFS. Configure your Office 365 as ADFS authenticated, and configure web API authenticated mode to ADFS. i have tested this in our MVC Application hosted in Azure and it is working as SSO. To configure ADFS You can check below link http://office365support.ca/...


1

This issue is resolved .I tracked the requests and responses by SharePointOnlineCredentials class in CSOM using fiddler and followed the same. Reference


1

I got the issue resolved by using view state for the Context Token property public string ContextToken { get { return ViewState["ContextToken"] != null ? Convert.ToString(ViewState["ContextToken"]) : String.Empty; } set { if (value != null) { ...


1

I had this same issue. The import error is towards the bottom "EncodeProviderUserKey couldn't encode provider user key for input [originalIssuerType:'Unknown'] [originalIssuerIdentifier:'office:idp:forms:customizedmembershipprovider'] [providerUserKeyValue:'i:0#.f|customizedmembershipprovider|testusername'] " First upgrade to August 2014 CU or higher ...


1

we can have the user login with their Office 365 credentials No, until user hand them to you himself. then get their original office 365 domain (xxxx.sharepoint.com) returned or something similar? Create a remote event receiver, so when an app is installed, it will return with host web URL, which can be done using an hidden app part (maybe) or somehow....


1

For those who are still looking for the answer - consider sp-request nodejs module. It allows you to perform OAuth client credentials grant (in different terminilogy it's also called addin-only permissions or application only permissions). For low-trust apps it uses AzureACS in order to obtain an access token, for high-trust apps (server 2 server ...


1

This was the exact problem I was facing. This is an old question but my answer might be helpful to someone else coming here. It is possible to do OAuth from Node.js or any other web-app. Here are the step by step instructions in my blog - https://medium.com/@yash_agarwal2/performing-oauth-and-rest-calls-with-sharepoint-online-without-creating-an-add-in-...


Only top voted, non community-wiki answers of a minimum length are eligible