OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

[Outlook] Office.context.mailbox.item.recurrence.getAsync is not getting the recurrence of event #1537

Closed iuri1994 closed 5 months ago

iuri1994 commented 3 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

Expected Behavior

When using the Office.context.mailbox.item.recurrence.getAsync I expected to get the recurrence of the event

Current Behavior

I am not getting the recurrence. the value that it's coming is null, it only changes when the event is saved and then reopened. The function Office.context.mailbox.item.addHandlerAsync(Office.EventType.RecurrenceChanged, handler, callback) works perfectly, but in the addin that I am making if the user changes the recurrence before opening the taskpane it's useless

Steps to Reproduce, or Live Example

Your Environment

Useful logs

image

exextoc commented 3 years ago

We are unable to repro the issue locally.

Screenshot

We followed the below steps:

  1. Open Outlook Web on Chrome
  2. Create a new calendar event
  3. Open Script Lab add-in and import https://gist.github.com/iuri1994/6f315f98a9281339e8e2fef534074860
  4. Change the recurrence of the meeting
  5. Wait for recurrence properties from handler
  6. Click Run to fetch recurrence properties using Recurrence API.

Can you share the steps you followed? Does this occur on other Outlook clients (Outlook Desktop, Outlook Mac, Outlook Online (OWA) on other browsers) ?

iuri1994 commented 3 years ago

Hi, I refreshed the file, https://gist.github.com/iuri1994/0c19503bcda03f9727986aa8e0d41af5, this happens in chrome and edge, with firefox the script labs was not working, so I couldn't try it there, in the outlook app it's working. I think the problem is when I use the saveAsync function before the recurrence function.

here is a small video of me testing it with all the steps.

https://www.youtube.com/watch?v=xx9slHmpr0Q&ab_channel=naotensnadaavercomisso

exextoc commented 3 years ago

Hello @iuri1994 , not sure we understand your issue completely. Can you please post the recurrence properties that you're receiving and also whats the expected behaviour? We see that in the video you've shared, the recurrence property JSON is coming up, as already communicated before.

iuri1994 commented 3 years ago

Hi, the problem is the function recurrence.getAsync where I am getting a Null value instead of the recurrence values. image

But when I use the addHandlerAsync I am getting the correct value.

After a few tests, this only happens when I reproduce these steps.

1 - open a new event (don't fill any field) 2 - open script lab and upload the file I shared ( https://gist.github.com/iuri1994/0c19503bcda03f9727986aa8e0d41af5) 3- click the 'Run' button that appears, the value from the recurrence will be Null because there is no recurrence. 4 - change the recurrence in the event 5 - press the 'Run' button again, the value of the recurrence should take the value from the recurrence field, but it's appearing that the value is Null

exextoc commented 3 years ago

Hi, the problem is the function recurrence.getAsync where I am getting a Null value instead of the recurrence values. image

But when I use the addHandlerAsync I am getting the correct value.

After a few tests, this only happens when I reproduce these steps.

1 - open a new event (don't fill any field) 2 - open script lab and upload the file I shared ( https://gist.github.com/iuri1994/0c19503bcda03f9727986aa8e0d41af5) 3- click the 'Run' button that appears, the value from the recurrence will be Null because there is no recurrence. 4 - change the recurrence in the event 5 - press the 'Run' button again, the value of the recurrence should take the value from the recurrence field, but it's appearing that the value is Null

Can you please try out the following code snippet for using getAsync in recurrence and test once? function myCallback(asyncResult) { var recurrence = asyncResult.value; console.log(asyncResult); if (recurrence == null) { console.log("Non-Recurring Meeting"); return; } } Office.context.mailbox.item.recurrence.getAsync(myCallback);

iuri1994 commented 3 years ago

Hello, The code you send me it's the normal code to get the recurrence, with that I can get the recurrence, but that is not the problem here, if you see the code I sent you, you will see that there is the saveasync function before the recurrence function. I tried your code without the saveasync function and it works, if you tried to follow my steps with the function you sent me, but put the saveasync before you will get the error.

if you can't reproduce this we can do a meeting where I could share the screen to show you.

I need the saveasync because it's the only way to get the event id in outlooks that use the older versions of the API, in newer versions I have the getItemIdAsync.

Best regards

exextoc commented 3 years ago

I used this following code to test. Office.context.mailbox.item.saveAsync(function(item) { Office.context.mailbox.item.recurrence.getAsync(function(asyncResult) { // debugger; if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { var recurrence = asyncResult.value; if (recurrence === null) { console.log('recurrence_function',"This is a single appointment."); } else { console.log('recurrence_function',Recurrence pattern: ${JSON.stringify(recurrence)}); } } else { console.error(asyncResult.error); } }); });

This works for us. First it saves the item (becomes a draft) and then the recurrence value is then shown. I am assuming this is the expectation here right?

iuri1994 commented 3 years ago

Yes, that's the expectation, but for me, it's not working in that way, the recurrence it's not coming with the correct value.

exextoc commented 3 years ago

Hey @iuri1994 ,

Apologies for the delay, it took a while to confirm things on our end. We are able to reproduce this issue now, and we have put it in our backlog to fix it. However, there are no timelines we can share at this point.

iuri1994 commented 3 years ago

Hi,

Do you have an estimated time to solve this issue?

Best Regards

Artsiom-L commented 2 years ago

Hi, I experience almost the same issue, but saving events doesn't help, and it only plays in Office on the web. osfweb version: 16.0.15201.10000 office-js-api version: 20220404.2

exextoc commented 2 years ago

Hi @ArtsiomLysianok: We are not able to repro this issue based on the details you provided. Please open a separate GitHub issue with repro steps so that we can investigate this further. Thanks!