Excel Online Add in- 403 when trying to autoshow and addin using a dev tenant - excel

Update: It seems like the XML is not the problem and the issue has to do with using a dev tenant. As far as I can tell, it behaves properly using an Office 365 Home account, but throws a 403 when using an Office 365 Enterprise E3 Developer account. Why does this throw a 403? Is there anything I can do so we can test if we can get an addin taskpane to auto show with our templates?
Title Edit: from "Excel Online Add in- How to auto show taskpane" to "Excel Online Add in- 403 when trying to autoshow and addin using a dev tenant"
Original:
I'm trying to auto show an addin following this guide: https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document
Since the manifest we currently have in the store doesn't use
<TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId> I'm trying to test it out using Script Lab
The <we:webextension> xml is below
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<we:webextension xmlns:we="http://schemas.microsoft.com/office/webextensions/webextension/2010/11"
id="{8bc018e3-f345-40d4-8f1d-97951765d531}">
<we:reference id="WA104380862" version="1.1.0.2" store="en-US" storeType="OMEX"/>
<we:alternateReferences/>
<we:properties>
<we:property name="Office.AutoShowTaskpaneWithDocument" value="true"/>
</we:properties>
<we:bindings/>
<we:snapshot xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>
</we:webextension>
In my <wetp:taskpane> I've tried setting visibility="1" and visibility="0", but neither seem to work. When it is 1 I get a 403 and this is my console
OsfRuntimeExcelWac.js:12 GET https://store.office.com/gatedserviceextension.aspx?=313351b2_2e0ee2d3_1500571610901&ui=en-US&rs=en-US&ad=US&fromAR=4 403 ()
e5191e878673e5c7.js:1 Uncaught ReferenceError: $ is not defined
at t.n (e5191e878673e5c7.js:1)
at new t (e5191e878673e5c7.js:1)
at e5191e878673e5c7.js:1
MicrosoftAjax.js:5 Refused to set unsafe header "Cookie"
HEAD https://store.office.com/gatedserviceextension.aspx?fromAR=3&corr=41fa9016-d510-90be-877b-25c612f780bb 403 ()
MicrosoftAjax.js:5 Request to /gatedserviceextension.aspx?fromAR=3&corr=41fa9016-d510-90be-877b-25c612f780bb came back with the status code:
When it's 0, there is nothing unusual in the console, but nothing happens.
What am I doing wrong? Am I just misunderstanding what this is supposed to accomplish? When visibility="1" it looks like it's trying to do something, but isn't allowed. Does it just mean I can't auto load Script Lab? Their manifest suggests that I can.
Any help is appreciated. We're looking at pushing a new version of our Manifest with the proper <TaskpaneId> to test this, but we wanted a proof of concept first.

This is indeed an issue with our code and a fix is underway. It only reproed in certain variations Office 365 for business customers. I'll update my answer once I get confirmation the fix has been fully rolled out.

How did you set
<we:property name="Office.AutoShowTaskpaneWithDocument" value="true"/>
in webextension?
Did you modify it directly?
You could try to set it by api in script Lab:
Office.context.document.settings.set("Office.AutoShowTaskpaneWithDocument", true);
Office.context.document.settings.saveAsync();

Related

Cors no-access-control-allow-origin when trying to call B2C login

I cannot resolve this error, i have a .net core web api, with a react application inside of it ( net core react template )
I have also added cors:
services.AddCors(options =>
{
options.AddPolicy("AllowMyOrigin",
builder => builder.WithOrigins("https://localhost:44300")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials()
);
});
I have tried multiple things but i cant get past this error.
I have found loads of material online to try and nothing seems to work i feel like i am missing something really obvious?
Can someone point me in the right direction.
I expect that there should be an allow origin header:
I also tried using the Mosif browser extension to turn cors on, this stoped the cors error from showing but now i have a 404 (notfound ) on:
https://login.microsoftonline.com/tfp/domainname.onmicrosoft.com/b2c_1_sign_up/v2.0/.well-known/openid-configuration
You mention that you get an 404 error when opening the openid-configuration url. This means that part of your configuration is incorrect. You must be able to open this url in your browser and get back a JSON document. Copy it to a new tab and tweak it until you get back a result.
Please double check your configured policy and tenant name. The full url usually looks like this:
https://tenantname.b2clogin.com/tenantname.onmicrosoft.com/<policy-name>/v2.0/.well-known/openid-configuration
https://tenantname.b2clogin.com/tenantname.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=<policy-name>
https://login.microsoftonline.com/tfp/tenantname.onmicrosoft.com/<policy-name>/v2.0/.well-known/openid-configuration
All of these are equally valid and can be used depending on your scenario.
The config should then look something like this:
authentication.initialize({
instance: 'https://tenantname.b2clogin.com/',
tenant: 'tenantname.onmicrosoft.com',
Another issue might be if your B2C tenant quite new, Microsoft could be blocking support for microsoftonline for your tenant. In this case, try switching to the b2clogin.com domain as your instance.
You can see a possible value for this url when opening the user flow in the Azure Portal.
As a sidenote, I would suggest switching to a different react library. The one you are using is not really being maintained. We are currently using https://github.com/syncweek-react-aad/react-aad

Authenticating a REST request in an Excel Add-in

I am trying to develop an add-in for Excel with the goal that it will create calendar events based on data inside a spreadsheet.
I can do almost everything that I want except use the REST API to build the events in the calendar and I can't exactly figure out where I went wrong.
I have followed the documentation suggested by #MarcLaFleur.
I can build and run the application no problem, but when I click on the 'Get my files from OneDrive' button, I get the following:
Code: 5001
Message: An internal error has occurred.
name: Internal Error
This is coming from the program.js file in the public directory somewhere in the else clause of this function.
function getDataWithoutAuthChallenge() {
Office.context.auth.getAccessTokenAsync({ forceConsent: false },
function (result) {
if (result.status === "succeeded") {
// TODO1: Use the access token to get Microsoft Graph data.
accessToken = result.value;
getData("/api/onedriveitems", accessToken);
}
else {
console.log("Code: " + result.error.code);
console.log("Message: " + result.error.message);
console.log("name: " + result.error.name);
document.getElementById("getGraphAccessTokenButton").disabled = true;
}
});
}
Here are the scopes in my manifest.xml
...
<WebApplicationInfo>
<Id>c931b396-7 ... </Id>
<Resource>api://localhost:3000/c931b396-7 ... </Resource>
<Scopes>
<Scope>files.read.all</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
And here are the scopes on apps.dev.microsoft.com:
If you can shed any light for me, it would really help me out.
5001 can be caused by not requesting profile scope. You need to request the profile scope in addition to Calendar.ReadWrite. You do this when you register the app, as well as in the manifest. For more information, see the articles that Marc LaFleur linked to.
The 5001 error often suggests something fundamentally wrong with the add-in API in Office. For example, your Office app doesn't support the API, the manifest is incorrect, or the version of office.js doesn't work with it. Since you're using the sample, two things come to mind:
You aren't running the latest Insiders
build
The wrong manifest is getting loaded (this sometimes happens if you're
on Windows and using a version of Visual Studio 2017 that has old
schema files, so you have to do a post-build clean up of the debug
Manifest XML)
Your manifest and Azure registration look mostly good, though Rick's comment about Scopes is relevant. profile must work with openid as a pair (profile alone won't work; openid alone won't work), and as discussed you need this consented. As the developer, you can try consenting for yourself at the protocol level. You’ll want to update the client_id, redirect_uri, and scope query parameters as appropriate, and add &prompt=consent.
To answer a later question, Excel and Mail add-ins are different, and my answer only applies to Excel. For Outlook there's a different sample.
The documentation can be found at Enable single sign-on for Office Add-ins. There is also walk though for both ASP.NET and Node.js as well documentation on Troubleshooting.
There are a number of things that could be going wrong here but without knowing more about your registration it is difficult to determine. That said, here are a couple of common mistakes:
You'll need to make sure you receive Admin Consent for the tenant you're developing against. This is only a dev requirement and won't be required once your publish to the Store.
Make sure you've pre-authorized the correct applications. You'll need pre-authorizations for:
d3590ed6-52b3-4102-aeff-aad2292ab01c (Microsoft Office)
57fb890c-0dab-4253-a5e0-7188c88b2bb4 (Office Online)
bc59ab01-8403-45c6-8796-ac3ef710b3e3 (Office Online)
Make sure the scopes you're defining in your manifest.xml are reflected in the app registration at apps.dev.microsoft.com.
If you make changes to your permission scopes, you need to make sure you repeat the Admin Consent process. When you receive consent, they are consenting to the scopes that were registered at the time of consent rather than the App ID itself.

OData service can be called in Browsers but in Excel 2016

I got a sample servlet using Olingo lib: https://odata-demoservice.run.aws-usw02-pr.ice.predix.io/DemoService.svc/Products. It works fine in Chrome/IE/FF or in Postman. But when I query in Excel 2016/OS Windows 10 with the steps like:
New Query
From Other Sources
From OData Feed
Got the error like: "We encountered an error while trying to connect. Details: Invalid URI: The hostname could not be parsed"
Any ideas are appreciated.
Thanks
#RodolfoOliveira: yes, I resolved this issue. the reason is that when I deployed it to Cloud, the uri in metadata is still http. What I did is implement a CustomProcessor and correct the url.
More detail is here: https://issues.apache.org/jira/browse/OLINGO-758
just need to do the custom Processor. Do the same as the original source but change a bit about the url. Detail in here: https://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/processor/DefaultProcessor.html
Register it with the Handler at first, then the issue should be solved.
ODataHttpHandler handler = odata.createHandler(edm);
handler.register(new CustomDefaultProcessor());
Hope this help.

can't display error messages with customErrors=Off in SharePoint 2010

I changed the following web.config:
1- VirtualDirectory\80\web.config
2- 14\TEMPLATE\LAYOUTS\web.config
3- 14\TEMPLATE\ADMIN\web.config
4- 14\CONFIG\web.config
CallStack="True", Debug="True" and customErrors="Off"
on all the 4 web.config files but still I can't display the detailed error message
I only get this:
server error in "/" application runtime error
and some instruction on how to display the detailed error message.
I need your help.
According to this link Sharepoint 2010 Server Error '/' in Application , you have to change the web.config of central administration too , then iisreset , please let me know if it works .
This post help me out on SharePoint 2013. It explains step by step how to enable custom errors Enable Debugging and set custom errors off in SharePoint.
Three key areas that the post mention are:
Turn on the call stack (CallStack="true")
Disable custom errors ()
Enable debugging ()
on the locations given on the article.

tcm:Error ErrorCode="80040302" can someone explain this error?

<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="80040302" Category="16" Source="Kernel" Severity="2" xmlns:tcm="http://www.tridion.com/ContentManager/5.0"><tcm:Line ErrorCode="80040302" Cause="false" MessageID="4613"><![CDATA[Unable to get list of Publication items.]]><tcm:Token>RESID_4485</tcm:Token><tcm:Token>RESID_4452</tcm:Token></tcm:Line><tcm:Line ErrorCode="80040302" Cause="false" MessageID="4394"><![CDATA[Unable to Initialize TDSE object.]]><tcm:Token>RESID_4537</tcm:Token><tcm:Token>TDSE</tcm:Token></tcm:Line><tcm:Line ErrorCode="80040302" Cause="true" MessageID="16226"><![CDATA[Access is denied for the user IIS APPPOOL\publishedlist.]]><tcm:Token>IIS APPPOOL\publishedlist</tcm:Token></tcm:Line><tcm:Details><tcm:CallStack><tcm:Location>Tridion.ContentManager.Security.AuthorizationManager.LoadAccessToken(String,IEnumerable`1,IEnumerable`1)</tcm:Location><tcm:Location>Tridion.ContentManager.Security.AuthorizationManager.LoadAccessToken(String,String)</tcm:Location><tcm:Location>Tridion.ContentManager.Session..ctor(String,String,UserContext)</tcm:Location><tcm:Location>Tridion.ContentManager.BLFacade.SystemFacade.InitializeUserContext(UserContext,String,String)</tcm:Location><tcm:Location>UtilitiesTDS.GetUserContext</tcm:Location><tcm:Location>TDSE.Initialize</tcm:Location><tcm:Location>TDSE.GetListPublications</tcm:Location></tcm:CallStack></tcm:Details></tcm:Error>
this error occurs while executing this line :
TridionCollection<Component> components = new TridionCollection<Component>(folder.GetListItems(ListColumnFilter.XMLListExtended, rowFilter), "[contains(#IsShared,'false') and contains(#IsLocalized,'false') ]");
I think the error itself is quite clear: User IIS APPPOOL\publishedlist has no permission to access Tridion. Now you need to understand why this user is trying to connect. There are several ways to resolve it. Try to figure out who is trying to connect with this user. Apparently IIS, but why (is it expected to connect with this user?)
If you are logging in with user A and you see error like this, it means that you want to impersonate user A with IIS APPPOOL\publishedlist. Just add IIS APPPOOL\publishedlist to impersonation users of Tridion and it will be fine.
If this user is some kind of service user that you are want to use to perform maintenance tasks or so - just create user in CM
Next time, please post some more details of what you were trying to do and where exactly you have a problem, otherwise your question will be downvoted and you will hardly get any answer.

Resources