Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Hi DiabloV,
Please let me know if I can be of further assistance.
Regards,
Hans
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am having issues using invoke-restmethod to harvest attachments from emails. All I want to do is place the attachment in a folder, and delete the email for multiple email accounts. It works, however it errors on any email with an attachment larger than 10MB, and will only grab 6-10 emails at a time. Some of my emails have attachments up to 100MB.
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At D:\TBIMailPoll\TBIMailPoll.ps1:104 char:24
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At D:\TBIMailPoll\TBIMailPoll.ps1:104 char:24
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And this is the piece of code I am using. The $query simply asks for all mail with attachments.
$query=$url+"/"+$message.Id +"/attachments"
$attachments = Invoke-RestMethod $query -Credential $Credentials
foreach ($attachment in $attachments.value ){ }
Is there a better way to do this? Am I missing a parm to accommodate larger attachments? I have scoured the web, and seen no palatable answers.
Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi DiabloV,
Please let me know if I can be of further assistance.
Regards,
Hans
Hi DiabloV,
Would you please provide the entire code for me to check the details. Meanwhile, does the Office 365 account is using Exchange online? You may provied the address of the account as well.
Please provide the code & account address via private message for privacy.
Regards,
Hans