Detemine root parent folder of a message with Outlook REST API - outlook-restapi

I am using Outlook REST API V2 (https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations)
Is there a way to determine the root parent folder of a message without making subsequent requests to get the parent of the parent of the parent, etc.. of the message folder?
In my case I would like to know if a message is "deleted", by finding out if the message is anywhere under the DeletedItems hierarchy.
Related to this - Is there a way to get all messages under a folder regardless of where in the sub-folders of the folder the message is, without making separate requests to traverse the sub-folders hierarchy?
Thanks for your time to anyone willing to help :)

No, there isn't any direct way by just looking at the message entities. You could sync the mail folder hierarchy down locally to your client, then essentially construct a list of IDs for the Deleted Items and any folders under it, then compare IDs in your message list. You'd have to be sure to keep the folder hierarchy table on your client in sync.
No, there is no deep traversal. If you get the /messages collection from a folder, it's only immediate children. If you get /me/messages, it's messages from all folders in the mailbox (which is more than what you're asking I think).

Related

Not able to get the drive items of newly created channel using graph api

I am first creating a channel using graph api and the trying shares/url end point url is encoded, and when I try it I am getting
Code: accessDenied Message: The sharing link no longer exists, or you
do not have permission to access it.
Neither I am getting the driveitems by passing the drive id which I get from endpoint teams/teamsid/channels/channel id/filesfolder.
I need to create certain folders immediately on creation of channel
When you create a channel, it won't create a files folder in share-point. You need to go to channel and click on files tab to create a files folder in share point. Teams create the files folder in share pint on Demand. This is by design. Could you please try going to channel in UI and redirecting to files tab and then check the folder using Graph API.
for getting driveitems look into following documents:-
https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http

Get user performing action in Sharepoint CSOM

We are using SharePoint client object model (CSOM) and REST/OData endpoints to retrieve/manage data on sharepoint.
Is there anyway to get information on the user performing the MOVE on a file (for example, move file from folder A to folder B within same site collection)? When I use this REST API call before and after the move, Author and Editor remains the same even though a completely different user moved the file from folder A to folder B. SPChangeItem does not seem to have any members with this information either.
https://{site_url}/_api/web/GetFileByServerRelativePath(DecodedUrl=#fileUrl)?$expand=Author,ListItemAllFields,ListItemAllFields/ParentList,ListItemAllFields/ParentList/ParentWeb&$select=UniqueId,Author/LoginName,Author/Email,Author/Id,Editor/LoginName,Editor/Email,Name,UserName,ServerRelativeUrl,MajorVersion,MinorVersion,Length,ListItemAllFields&#fileUrl={url_encoded_file_path}
Is there anyway to get logged in user while using REST API?
When I use this REST API call, Id returned is the user corresponding to Bearer accesstoken.
https://{site_url}/_api/Web/CurrentUser?$select=Id
When moving a file to another folder, the metadata including author/editor is remained the same one, what changed is only the location. This is by designed.
If we want to know the user who performed this operation, we could check the version events of the file as it will immediately prompt an modification event when moving a file.
FileVersionEvent
Rest API endpoint:
_api/Web/GetFileByServerRelativePath('filepath')/VersionEvents
Thanks

Datacap Email count and connect to a specific folder

I have two requirements in Datacap 9.0.1
I want to find how many emails that were sent to the done folder and
how many were sent to problem folder. This way, I can alert the
users that say, out of 10 emails in the inbox, 7 of them processed
successfully and 3 moved to the problematic folder. I know
EmailCount variable gives me the count of emails that datacap was
able to read successfully/moved them to the done folder but what I
want is the initial count of emails so that I can find a difference.
Is it possible within datacap to scan a folder other than Inbox? For
Ex, if I want to scan 'Sent Items' folder how would I do that? I
looked into the email connection actions, but I don't see anything
which can help me to connect to the folder that I want.
Ok, this is the answer that I got from another datacap forum. Posting it here so that it helps others
Not sure about number 1. I believe that would require modifications to the mail actions.
For #2, no, there is no way to specify something other than inbox.
Both of these would likely require some sort of enhancement.
Here the enhancement means creating datacap custom actions. I haven't tried creating one and in case if I happen to create, will post the details of it.

Outlook REST API - getFolders not returning all folders

I'm just getting started with the Outlook REST API. My baseline is the tutorial that uses node-outlook.
First order of business is to retrieve all of the folders in my mail account.
So I issue this REST request:
GET https://outlook.office.com/api/v2.0/Me/MailFolders
Instead of returning all of my folders, it only returns the "well known" folders:
Clutter
Deleted Items
Drafts
Inbox
Junk Email
Outbox
Sent Items
Trash
Am I missing a query parameter or something that says, "no, really, all of them please"?
UPDATE
I tried a different email account, and I also don't get all of my actual folders, but I get a different subset (some of which are well-known, others aren't).
I am implementing the paging protocol (using the #nextLink parameter) so it's not a matter of page sizes. I am getting these 8 folders on one account, and 18 folders on another.
So there must be something that decides what folders will be returned.
UPDATE 2
I changed to doing a folder sync instead using the "beta" API. In this case, I also get an unnamed folder in the list, which is the parent of the other folders. It comes along with a ChildFolderCount which is accurate. However, when I do a child folder request on that folder id I get the same list.
UPDATE 3
Here's the request url I'm using when I attempt to read the child folders of the one folder that comes back with a non-zero ChildFolderCount.
GET https://outlook.office.com/api/beta/Me/MailFolders/AAMkADRmMzFmNjZmLWU3MjctNGZiNi1iZTg4LTRmNGQwYTVhMDgxYgAuAAAAAAB8IxaZ5KGbQom4EPywGCSdAQDVy0eYwAzLS63k5pohzykCAAAAAAEJAAA=/childfolders
Here's what appears to define what folders are returned by this API and what are not:
If I create a folder in office365 directly on outlook webmail, it shows up in this query.
If I create a folder in Mac Mail, it does not.
Mac Mail accesses the service using EWS, so I would expect a folder created by it would be like any other folder.
So there is something about folders created on Mac Mail that prevents them from being returned by this API.
Folders created in Mac Mail DO show up in web mail and vice versa.
Folders created on an iPhone DO show up, so in my limited testing it looks like Mac Mail may be the only app suffering from this problem. The problem I have is most of my folders were created in Mac Mail and I have no easy way of rebuilding them.
I'm thinking this is just a BUG in the API. At any rate, this answers my original question and should help anyone out there trying to use the new API.
If I find a workaround I'll post it here.

Api to access Conversation History and In Place Hold for Office 365

We are trying to access the Conversation History in Office 365 for accessing the chat history.We are using the Rest Apis provided in https://msdn.microsoft.com/en-us/office/office365/api/API-catalog#Outlookmail . However , we are unable to get the folder id of the folder Conversation History . As a result , we are not able to fetch the mails under Conversation History. Is there a way to get access to the chat history under the folder "Conversation History ?
We are also , interested to get the data for chats which might be deleted by mistake by the users from Conversation History. Hence , we are looking for getting the data for in place hold users as well.
Please use https://outlook.office365.com/api/v1.0/me/folders/ConversationHistory/Messages to get the messages in ConversationHistory folder. For well known folder names (Inbox, DeletedItems, ConversationHistory etc.), we allow you to specify the folder ID or the well known name. The response always refers to the folder using the folder ID. We will look into why https://outlook.office365.com/api/v1.0/folders/ConversationHistory is failing.

Resources