OfficeDev / office-js-docs-pr

Microsoft Office Add-ins Documentation
https://learn.microsoft.com/office/dev/add-ins
Creative Commons Attribution 4.0 International
400 stars 247 forks source link

example doesn't work #2558

Closed gspagoni closed 3 years ago

gspagoni commented 3 years ago

[Enter feedback here]


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

I'm trying to test the example but it doesn't work, it complains about the access token. what I would like to achieve is calling an API to enable the ouf of office from task pane because I want to invoke also another API that enable out of office for another application. so I would like to create an adding that enable out of office both for outlook and for my application but I cannot find any API to enable ooo for outlook. i would avoid to sign-in as I'm already logged with my user. any help? thanks

AlexJerabek commented 3 years ago

Hi @gspagoni,

Thanks for reporting this access token issue. @ElizabethSamuel-MSFT, can you please investigate?

ElizabethSamuel-MSFT commented 3 years ago

@gspagoni Sorry that you're facing issues with this. However, can you provide some more details to help us repro? For example, what error are you getting re: the access token? Can you share your sample code and manifest? Which client/platform are you testing with (Windows, Mac, browser, etc)? Which Exchange version are you pointing to (Exchange Online, on-premises)?

Thanks.

ElizabethSamuel-MSFT commented 3 years ago

@gspagoni As for an API to set "out of office", I also believe we don't have such an API. I've also tagged this issue as feature request so we can track. @JuaneloJuanelo FYI

ghost commented 3 years ago

Thanks for your interest in Office Add-ins development! Feedback here is intended for reporting problems with the Office Add-ins documentation. We will tag this as a feature request. Please see https://support.microsoft.com/en-us/topic/uservoice-pages-430e1a78-e016-472a-a10f-dc2a3df3450a for more information. Thanks!

lindalu-MSFT commented 3 years ago

@ElizabethSamuel-MSFT We should move this feature request to office-js so we can track it with the Feature Request tag there.

ElizabethSamuel-MSFT commented 3 years ago

@lindalu-MSFT I'll move to office-js to track the feature request portion after we resolve the issue with REST API example, if possible.

gspagoni commented 3 years ago

My Office Add-in.zip thank you for your answer. I have attached my project created with yo generator my goal as I said is to create an addon which set OOO for outlook and for another external application at the same time. ofc for outlook i don't want to authenticate with oauth2 because I'm already logged in, so I was looking for some API that return the token and pass it to the microsoft.grap API, but the token I can get from outlook.api is not compatible with microsoft.grap API, hope this clarify the scope. thank you

ElizabethSamuel-MSFT commented 3 years ago

@gspagoni Thanks for sharing this info.

@exextoc Can you take a look?

Thanks.

exextoc commented 3 years ago

@gspagoni - Currently there isn't an Office JS API that allows you to set a OOO message or get a token that can be used against Graph. The getCallbackToken API with isRest set to true that you use in your code only returns a token that can be used against a REST API endpoint, hence the error when using that token against a Graph API. That said, the REST token returned only has item and calendar level scopes, which means that it won't allow you to set OOO message for Outlook through the REST endpoint. To be able to use a Graph API, we recommend looking into authenticating the user with SSO token.

gspagoni commented 3 years ago

Hello and thank you for your answer, I tried a piece of code that I read into the the page of the SSO token link

export async function run() { /**

the response is the attached snapshot 2021-03-29 17_40_01-Posta in arrivo - Giampaolo Spagoni@infor com - Outlook

can you tell me how can I get a valid token that I can use with microsoft.graph API? thank you GS

exextoc commented 3 years ago

Could you share the exception.code that you are running into? Here's a link for reference to troubleshoot and identify the exception.code and what they mean: https://docs.microsoft.com/en-us/office/dev/add-ins/develop/troubleshoot-sso-in-office-add-ins

gspagoni commented 3 years ago

the error code is 13000

Modify the source files, then click Run. Run

13000

exextoc commented 3 years ago

Based on it being the 13000 error code, it's possible that:

Could you share your Outlook build number and subscription channel? And check that WebApplicationInfo in the manifest. Please also make sure that the prerequisite steps (e.g. Enable modern authentication, Register your add-in etc.) listed before the "Get SSO Token" instruction are taken care of: https://docs.microsoft.com/en-us/office/dev/add-ins/outlook/authenticate-a-user-with-an-sso-token

gspagoni commented 3 years ago

2021-04-01 10_47_01-Posta in arrivo - Giampaolo Spagoni@infor com - Outlook attached the version of outlook

below the manifest file

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

92379c22-6ffc-4880-bd8a-dcb373bd09f9 1.0.0.0 Contoso en-US https://www.contoso.com
250
ReadWriteItem false