-
-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't browse public_folders_root anymore #1288
Comments
I believe this is what has been reported in #1273 (comment) as well. |
we are getting similar issue as of around the same time yesterday. Our error says, "Not Allowed to access Non IPM Folder". This was working until yesterday. |
If this happened without changing the exchangelib version, then it must be caused either by a change in the server configuration or because of a server patch/upgrade. |
This post from the Veeam Community Forum (an Exchange backup solution also affected) may help solve the issue: https://forums.veeam.com/veeam-backup-for-microsoft-365-f47/failed-to-get-folder-properties-not-allowed-to-access-non-ipm-folder-t93166.html#p515735:
|
I'm getting the "Not Allowed to access Non IPM Folder" error suddenly as well. It started at 12:48pm GMT-5. We use O365 Exchange. |
Can someone post the XML request leading to the reponse that contains the error message, and that response as well? See https://ecederstrand.github.io/exchangelib/#troubleshooting on capturing the XML. |
account = Account(
primary_smtp_address=session["email"],
access_type=DELEGATE,
config=conf,
autodiscover=False,
)
print("TOP")
print(account.public_folders_root.tree())
print("bottom") Request XML: <?xml version='1.0' encoding='utf-8'?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<s:Header>
<t:RequestServerVersion Version="Exchange2016"/>
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="Eastern Standard Time"/>
</t:TimeZoneContext>
</s:Header>
<s:Body>
<m:GetFolder>
<m:FolderShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="folder:DisplayName"/>
<t:FieldURI FieldURI="folder:FolderClass"/>
<t:FieldURI FieldURI="folder:PermissionSet"/>
</t:AdditionalProperties>
</m:FolderShape>
<m:FolderIds>
<t:FolderId Id="************" ChangeKey="************"/>
<t:FolderId Id="************" ChangeKey="************"/>
</m:FolderIds>
</m:GetFolder>
</s:Body>
</s:Envelope> Response XML: <?xml version='1.0' encoding='utf-8'?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo
xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="20" MajorBuildNumber="7409" MinorBuildNumber="45" Version="V2018_01_08"/>
</s:Header>
<s:Body>
<m:GetFolderResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="************" ChangeKey="************"/>
<t:FolderClass>IPF.Note</t:FolderClass>
<t:DisplayName>TB Ticket Archives</t:DisplayName>
<t:PermissionSet>
<t:Permissions>
<t:Permission>
<t:UserId>
<t:DistinguishedUser>Default</t:DistinguishedUser>
</t:UserId>
<t:CanCreateItems>false</t:CanCreateItems>
<t:CanCreateSubFolders>false</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>None</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>None</t:ReadItems>
<t:PermissionLevel>None</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-26622769</t:SID>
<t:PrimarySmtpAddress>************</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>All</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>PublishingEditor</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665204</t:SID>
<t:PrimarySmtpAddress>s************</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>false</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Custom</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665143</t:SID>
<t:PrimarySmtpAddress>s************</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>true</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>true</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>All</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Owner</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665205</t:SID>
<t:PrimarySmtpAddress>************@************.com</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Custom</t:PermissionLevel>
</t:Permission>
</t:Permissions>
</t:PermissionSet>
</t:Folder>
</m:Folders>
</m:GetFolderResponseMessage>
<m:GetFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="************" ChangeKey="************"/>
<t:DisplayName>TECHBLDRS INC</t:DisplayName>
<t:PermissionSet>
<t:Permissions>
<t:Permission>
<t:UserId>
<t:DistinguishedUser>Default</t:DistinguishedUser>
</t:UserId>
<t:CanCreateItems>false</t:CanCreateItems>
<t:CanCreateSubFolders>false</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>None</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>None</t:ReadItems>
<t:PermissionLevel>None</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-26622769</t:SID>
<t:PrimarySmtpAddress>************</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>All</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>PublishingEditor</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665143</t:SID>
<t:PrimarySmtpAddress>************@************.com</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>true</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>true</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>All</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Owner</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665204</t:SID>
<t:PrimarySmtpAddress>************@************.com</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>false</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Custom</t:PermissionLevel>
</t:Permission>
<t:Permission>
<t:UserId>
<t:SID>S-1-5-21-4157035154-673357884-1224084594-49665205</t:SID>
<t:PrimarySmtpAddress>************@************.com</t:PrimarySmtpAddress>
<t:DisplayName>************</t:DisplayName>
</t:UserId>
<t:CanCreateItems>true</t:CanCreateItems>
<t:CanCreateSubFolders>true</t:CanCreateSubFolders>
<t:IsFolderOwner>false</t:IsFolderOwner>
<t:IsFolderVisible>true</t:IsFolderVisible>
<t:IsFolderContact>false</t:IsFolderContact>
<t:EditItems>All</t:EditItems>
<t:DeleteItems>None</t:DeleteItems>
<t:ReadItems>FullDetails</t:ReadItems>
<t:PermissionLevel>Custom</t:PermissionLevel>
</t:Permission>
</t:Permissions>
</t:PermissionSet>
</t:Folder>
</m:Folders>
</m:GetFolderResponseMessage>
</m:ResponseMessages>
</m:GetFolderResponse>
</s:Body>
</s:Envelope>
|
@ecederstrand Here's another example from my environment: credentials = OAuth2Credentials(
client_id=client_id,
client_secret=client_secret,
tenant_id=tenant_id,
identity=Identity(primary_smtp_address=primary_smtp_address),
)
config = Configuration(credentials=credentials, server=smtp_svr, auth_type=OAUTH2)
account = Account(
primary_smtp_address=primary_smtp_address,
credentials=credentials,
config=config,
access_type=IMPERSONATION,
)
email_folder = account.inbox / inbox_subfolder_name # Error occurs here |
Just adding to what's been said above - we started to have the same issue at around 1pm US Eastern time. |
This error appears on almost all actions like:
BUT, if you are using FolderCollection, you will not get that error. Here is a dirty, tiny, working example: i hope it helps finding differences in the code base. possible WORKAROUND fav_folder = None
inbox_folders = FolderCollection(account=account, folders=[account.inbox])
for folder in inbox_folders.find_folders(depth="Shallow"):
if folder.name == "MyFavouriteSubFolder":
fav_folder = folder
for mail in fav_folder.all().only("subject", "sender", "datetime_received"):
print(mail.sender.email_address) |
@ecederstrand I noticed in my response xml (see my previous comment) that Teams folders are being queried (e.g. TeamsMessages and TeamsMeetings). Assuming this is at the core of the issue, is there a way we can exclude those folders? |
@ecederstrand I'm posting here examples as well, this have the response "Not allowed to access Non IPM folder." Request XML <?xml version= '1.0' encoding= 'utf-8'?>\n
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<s:Header>
<t:RequestServerVersion Version="Exchange2016" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>replaced_address@replaced_domain</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="****REPLACED****" />
</t:TimeZoneContext>
</s:Header>
<s:Body>
<m:GetFolder>
<m:FolderShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="folder:DisplayName" />
<t:FieldURI FieldURI="folder:FolderClass" />
<t:FieldURI FieldURI="folder:PermissionSet" />
</t:AdditionalProperties>
</m:FolderShape>
<m:FolderIds>
<t:FolderId
Id="****REPLACED****"
ChangeKey="****REPLACED****" />
</m:FolderIds>
</m:GetFolder>
</s:Body>
</s:Envelope> Response XML <?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="7409"
MinorBuildNumber="45" Version="V2018_01_08"
xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</s:Header>
<s:Body>
<m:GetFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<m:GetFolderResponseMessage ResponseClass="Error">
<m:MessageText>Not allowed to access Non IPM folder.</m:MessageText>
<m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders />
<m:GetFolderResponseMessage ResponseClass="Error">
<m:MessageText>Not allowed to access Non IPM folder.</m:MessageText>
<m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders />
</m:GetFolderResponseMessage>
</m:Folders>
</m:GetFolderResponseMessage>
</m:ResponseMessages>
</m:GetFolderResponse>
</s:Body>
</s:Envelope> I edited the message to keep the error lines.. it was too big.. <m:GetFolderResponseMessage ResponseClass="Error">
<m:MessageText>Not allowed to access Non IPM folder.</m:MessageText>
<m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders />
</m:GetFolderResponseMessage> |
This worked for us as a stop gap fix. Thanks! |
Awesome this worked for us appreciate it! |
Hey! I'm attempting to use FolderCollection as a workaround, but having some issues understanding on how to implement it. Would you guys be able to explain how to add it in so that it avoids trying to access the Teams* folder? Thank you! |
Worked for us as well. |
Can you provide an example of what isn't working? |
Worked for moving to different folders:
|
Hi, I am receiving this issue Not Allowed to access Non IPM Folder, but when I call inbox_folders.find_folders(depth="Shallow") I don't receive any folder, does anyone know if this will have a solution? |
Are your folders under inbox? This only works if your folders are subfolders of the "Inbox" folder. |
The workaround worked for the EWS O365 integration in Palo alto XSOAR... this is dirty code, but can help you those ingest incidents with this integration, while a patch from palo alto emerges.
|
Exactly what I needed for my use case, thank you sir! |
Another way to fix cases like |
Awesome HotFix, a no brainer! |
Worked for me in preliminary test just now. Literally only changed the |
It work for me too if I want only iterate over email in specific folder but not work when I want iterate over folder/subfolder |
Good work finding workarounds, unfortunately in our case we need to browse folders in a path, so we use |
The problem here seems to be that O365 has some folder that it will return in a We may be able to provide a fix for exchangelib to handle this situation. |
But let's continue discussion of the |
@ecederstrand
|
I am unable to download all the sentbox or inbox mails, meaning when I download the data and write to an excel I get handful of emails like 5-6 only downloaded for a particular day, while when I open the mail using webmail on my browser I see the mails count in 50-100 etc for a particular day
|
A working code is no longer able to browse public_folders_root folder
from exchangelib.folders import Calendar
from exchangelib import IMPERSONATION,DELEGATE,Credentials, Account, CalendarItem, UTC_NOW, Configuration, EWSDateTime
from exchangelib.version import Version, EXCHANGE_O365
from exchangelib import OAuth2Credentials, OAUTH2
credentials = OAuth2Credentials (
client_id='omissis',
client_secret='omissis',
tenant_id='omissis'
)
config=Configuration(server='outlook.office365.com',
credentials=credentials,
version=Version(build=EXCHANGE_O365),
auth_type=OAUTH2
)
import datetime
import json
import EWS_config
account = Account(
primary_smtp_address=EWS_config.primary_smtp_address,
autodiscover=False,
config=config,
access_type=IMPERSONATION
)
account.public_folders_root.refresh()
print(account.public_folders_root.tree())
Returns "IPM_SUBTREE" and no subfolders, that exist.
Python 3.7 and exchangelib 5.0.2 on debian 10
Thanks
The text was updated successfully, but these errors were encountered: