Closed gspagoni closed 3 years ago
Hi @gspagoni,
Thanks for reporting this access token issue. @ElizabethSamuel-MSFT, can you please investigate?
@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.
@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
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!
@ElizabethSamuel-MSFT We should move this feature request to office-js so we can track it with the Feature Request tag there.
@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.
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
@gspagoni Thanks for sharing this info.
@exextoc Can you take a look?
Thanks.
@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.
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() { /**
Insert your Outlook code here */
try { let bootstrapToken = await OfficeRuntime.auth.getAccessToken(); document.getElementById("token").innerHTML = bootstrapToken
// The /api/DoSomething controller will make the token exchange and use the // access token it gets back to make the call to MS Graph. //getData("/api/DoSomething", bootstrapToken); } catch (exception) { if (exception.code === 13003) { document.getElementById("user").innerHTML = exception.code
// SSO is not supported for domain user accounts, only // Microsoft 365 Education or work account, or a Microsoft account. } else { // Handle error document.getElementById("user").innerHTML = exception.message
} }
the response is the attached snapshot
can you tell me how can I get a valid token that I can use with microsoft.graph API? thank you GS
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
the error code is 13000
Modify the source files, then click Run. Run
13000
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
attached the version of outlook
below the manifest file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Based on your build number, it should support SSO. Just as a sanity check can you try calling isSetSupported('IdentityAPI', '1.3') and make sure it returns true. You seemed to have pasted only a portion of the manifest, can you relink/upload the manifest? Also again, please 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
attached the manifest manifest.zip thank you
Hi, i read the article you suggested above. i don't have the rights to register the add-in to the Azure AD, I'm not an IT admin, I'm a solution architect creating Demo. I'm aware of the security stack which is very important, but at the same time I thought once I'm logged in to use a SAML bearer token for my user to setup properties to my account, which seems to be very hard. as I said I'm looking for a simple way to setup the OOO for my user from an add-in using microsoft-graph API because from the same add-in i want to setup an OOO also for another application where now I must use the OAuth2.0 grant flow because I need to access another IDP to get the token. thank you
To unblock your development and demo, you can create a development tenant through the Microsoft 365 Developer Program. This will allow you to grant administrator consent to the add-in.
Does this unblock your scenario?
Hi , i read the MS 365 Developer Program and i tried to create an account using my company account, but I'm denied to switch to the admin center. see the attached snapshot, I think I can create a developer program with my own account but then how can I use it to authenticate add in for my company account?
You would log into this developer account profile page with the account you used to register for the program. And from there, you can setup a tenant (ending in onmicrosoft.com) with its own administrator account (also listed on that page) that can be used to access your developer tenant's admin page.
Typically a website will prompt you for which account you use to access the portal. You can also use different browser profiles to keep the two accounts separate.
If you need to demo using data from your company tenant, in that case, you would need to work your IT department to get your application access to that data. But if you can demo from the developer tenant, using test data, you could setup the application and add-in in that tenant. (Even in the case where you eventually deploy the application to your company tenant, you may find the developer tenant useful to test with your own data and setup).
can i add the account i used to register for the program in outlook client? in this case can I use it with the adding I'm trying to develop for setting OOO. thank you
This program allows you to create a new email account to test with (you could use the automatically-created admin account, or use the admin account to create a test user within the developer tenant). Either of those accounts, you can add to Outlook. It's a fully-functioning M365 account. It can be used to develop add-ins for any application including Outlook.
For example, you can add the test user to your existing Outlook installation and manually set its out-of-office status, and also install your add-in and use it to set the out-of-office status (Outlook add-ins in particular are tied to a specific email account rather than the client).
The developer program doesn't make any changes to the account you used to register for it. Your personal or company account is only used to create or delete the developer tenant from the profile page I linked to. (You can also optionally install a sample pack from that page, which will populate the tenant with sample users and emails).
This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!
i cannot progress further with my company account please close the issue thank you GS
[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