Open hdwatts opened 11 months ago
Hi @hdwatts , thank you for raising the problem!
'OnReady' is designed to be called until user takes action in an add-in. Could you please try 'Automatically open a taskpane with a document' to see if it fits your scenario?
We apologize for the inconvenience, but we do not support the scenario you mentioned at the moment. If you would like to request this feature, please post it on our developer forum, where our product managers will regularly review and prioritize the suggestions.
@dingjin-ms Thanks, I have made a post there. I looked through that documentation already and unfortunately it doesn't solve the use case. Ideally, we would be able to ensure that the ribbon is accurate no matter what document is open, not just ones that we have tagged as such.
As it stands, this is going to lead to a lot of confusion for our users and it is disappointing that this isn't possible.
Does the Microsoft team have any guidance on recommended practices for handling access with ribbon controls?
Provide required information needed to triage your issue
We have an
Office.onReady
function that enables/disables "Login" and "Logout" buttons in the ribbon to match the user's logged in state.When a user opens a new document, the onReady function does not get called until either a custom function is ran or the taskpane is open.
Is there an initialization function we can call when the custom functions are registered? According to the runtime logs, they get registered every time a document is opened which is when we would ideally be calling this.
See below video, which was taken with a fresh workbook and showcases that both
Office.initialize
andOffice.onReady
aren't called until a function is ran - and then my ribbon updates to the intended state.https://github.com/OfficeDev/office-js/assets/16158417/33070de4-cc3a-444d-a0c6-b2c1cff3016e
Your Environment
Expected behavior
I expect onReady to be called when a document is open and the ribbon is visible.
Current behavior
onReady is not called until an action is taken by the user to run a command from our Add-in.
Steps to reproduce
Link to live example(s)
See video.
Provide additional details
N/A
Context
We would like to show the user's login state, and also disable/enable buttons based on who is logged in. Users will be confused if they are presented with disabled buttons that should be enabled, or with a login button when they have already logged in.
Useful logs
See video above
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.