I would like to write an Excel Task Pane app to interact with CRM Online - to take data from the Excel worksheet, process it and push it into a CRM entity record. My Excel users are on Office 365, as is CRM Online (obviously). We are using ADFS 2.0.
The specific problem I am experiencing is that I do not know how to get authentication to work for the Task Pane app: specifically, to the OData endpoint via JavaScript. Authentication is not my area, so I don't know how to precisely phrase this next requirement, but as we are using Office 365/CRM Online/ADFS then I need to use the logged-in user's Windows AD credentials to authenticate the request.
As far as I can tell, it is not possible to authenticate the Task Pane app directly with CRM Online, and I would like to know if that is known to be true, and if not what method(s) I can use.
I do know that there is a hack for indirect authentication published by a couple of people (http://survivingcrm.com/2013/12/connecting-crm-online-odata-feed-excel-2013-power-query/ or http://www.crmconsult.co.uk/connecting-to-crm-20112013-with-odata-in-excel-2013/) which authenticates the user via the CRM plug-in and then allows other OData connections to succeed - but it doesn't work for me, and I'm averse to rolling out functionality to users which relies on back-door methods.
In the end, I ended used using SOAP in VBA instead of oData in the Task Pane, which meant I was able to use Jason Lattimer's hard work from http://jlattimer.blogspot.co.uk/2015/02/soap-only-authentication-using-vba.html - I don't think there is any way I would have figured out the Authentication piece without that post, so many thanks to him.
Related
This might be a long shot, but I'm using the MYOB Business API which has the same OAuth authorization flow as the LinkedIn API - 3-legged - and am planning on making queries to it through Excel, most likely power query.
The big issue with this is obviously dealing with the sending and receiving of the code=, access_token and refresh_token. Most of the searches I've done relating to using Power Query and OAuth seem to only deal with username and password OAuth and not the authorization flow, shown here https://developer.indeed.com/docs/authorization/3-legged-oauth.
I'm curious if there is Power Query M Language code out there that I haven't come across or if I have to go the route of building an OData Feed (or another method?) on top of the API so that it can be queried in Excel?
Any help or further direction would be appreciated.
I should also note they have a website containing their Postman collection using different languages here; https://accountrightapi.myob.cloud/?version=latest#f2b93dfa-803f-44b9-8a07-756874494227
The short answer for Excel is: No, but Asterisk.
Excel Power Query doesn't support custom connectors (as of 2022-02-07)
To securely use Auth2 flow, it requires a custom connector
There is some built in support, if the connector supports it. ( Like Web or OData)
Here's a summarized version of Chris Web. (He's a Power Query Wizard) Connecting To REST APIs With OAuth2 Authentication In Power Query/Power BI # blog.crossjoin.co.uk
the definitive, Microsoft-endorsed answer to this question is:
If want to connect from Power BI to a REST API that uses OAuth2 authentication then you need to build a custom connector.
You can use OAuth2 credential flow in regular Power Query queries without needing a custom connector.
this is not recommended: it’s not secure and it’s not reliable. In particular, hard-coding usernames/passwords or client ids/client secrets in your M code is a really bad idea
The only exception is that you can connect to some APIs that use AAD authentication using the built-in web or OData connectors
To use a custom connector in the Power BI Service, it requires an on-premises gateway
How to implement OAuth2 flow
Creating a Custom Connector
Using built-in OAuth2 flow using with Azure Active Directory using the Web and OData connectors
I used excel VBA code to handle the MYOB API connection by invoking MS Edge, with Seliumn Basic drivers.
VBA then executes the MYOB API Connector Add-On.
VBA receives the database files I require from MYOB and writes them to a.txt file location on my PC.
VBA then refreshes the data connections for Power Query which runs the M Code I’ve written in advanced editor.
When I close excel, VBA closes all the connections and MYOB add on connector.
I am trying to use the Office 365 API to write events to the calendars of anyone at our organization. This should not involve the users logging in to Office 365 at any point. The events to add are written out at various points during the day (when the user who would own the event may not even be at a computer), so the per-user token approach doesn't even make sense.
It appears that Microsoft provides an alternative that uses a service account. This account can be used to write to any user's calendar (or sending email as any user, etc.). However, I can't find any documentation on doing this. Could anyone provide a link to it?
I found a blog post on this topic: http://blogs.msdn.com/b/exchangedev/archive/2015/01/21/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx
Also, if you aren't using Microsoft's client library for this (for example, if you use linux), you'll need to see this too: Office 365 Rest API - Daemon week authentication
I'd like to read and write cells on an Excel Web App hosted at Office 365. There seems to be conflicting information online whether API access to EWA is even possible.
I would expect to use some of the RESTful APIs, such as the following:
https://[myoffice365site]/personal/[myusername]/Documents/[myworkbook].xlsx/model
But when I do, I receive a generic 404 error. I've also been unable to find any tokens or API keys in my Office 365 account.
Has anyone had any luck accessing an Excel Web App using C# or Javascript?
Thank you!
hbeam
Yes, we do have an API that allows reading and writing to cells in Excel Web App via a JavaScript library. This code needs to be running in an "App for Excel" which is embedded in the Excel document. Here's some documentation to get you started: http://msdn.microsoft.com/en-us/office/dn448457
If you reply with some additional information about what you are trying to accomplish with the app, I can give further guidance on which API to use and how to use it.
A RESTful API to accomplish what you're asking is not currently available. We've heard from many developers and customers who are interested in that type of programmability, and we'll take your feedback into account.
Thanks for the question!
-Michael
I am working with an utility application which has user authentication(i.e. it takes username password from users as input). Previously I worked with CRM online. Now requirement is this utility should be able to connect all three deployment types of CRM (i.e. Onpremise, Online, IFD).I am not sure how to do it. I was using crmservice.cs and deviceidmanager.cs for connection with CRM.
From other online resources I found that in connection string if I add Authentication Type="Integrated"/"AD"/"SPLA"/"Passport" , it should work.
So If I write my connection string like
connectionString="Authentication Type="Integrated";Data Source= LINE500\sage;Initial Catalog=cs3live; Integrated Security=false; User Id=XXXXXXXX;Password=XXXXXXXX"
Is this gonna work? FYI, I have only CRM online trial account to verify my code.So I need your help on this.
Thanks.
a CRM Online environment can use Windows Live ID or Office 365 authentication, DeviceID and DevicePassword are necessary only when connecting with Windows Live ID credentials. So you need to know which authentication type is in use in your CRM.
To be able to connect to different environments I suggest to use the Simplified Connection, you can find more information here:
https://stackoverflow.com/a/15930366/2191473
and here:
Sample: Simplified Connection Quick Start using Microsoft Dynamics CRM
I'm using a code from CRM2011KIT "CRM Online from PHP". And I'm able to create or update entities without any problem from PHP.
But now we need to use impersonation, and I cannot find any example or documents how to do that using LiveID authorization, CRM Online and simple XML requests (of course I'm not able to use SDK from PHP).
I will be glad to hear that somebody solve the problem like mine or have some idea. But I even cannot imagine where to place "CallerID" in current soap XML requests
Have you looked at this?
CRM Online 2011 WebServices - SOAP Only Client
They do bare SOAP requests and there is support for LiveID & Office365 logins