-
Notifications
You must be signed in to change notification settings - Fork 167
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
Update-MgPlannerTaskDetail not attaching a file to the task #2322
Comments
Hi DaveTustin, Reading through the Graph documentation, it sounds like your URL will need to be encoded: The thing I'm a little perplexed about is that apparently percentage (%) is not allowed within open types, yet it forms the basis of URL encoding - and is even included in the example. I would recommend at least having a go at manually encoding the URL, and then seeing whether that works, then there are a few other articles in this project which talk about dynamically encoding URLs. Looking at your debug output, it's likely to be the colon present at http:// and potentially full stop/period just before eml. |
Hi SeniorConsulting, Thanks for reaching out, I really appreciate it. This issue is starting to drive me insane! Ha Encoding the URL is a really good shout and something I haven't tried. Unfortunately I still get the same outcome when I encode it manually. The URL is below. I really hoped that was the answer.
For reference, this is the code for doing it using the RestAPI directly. I was able to attach the file to the task using it.
The |
Dang, I had hope that'd work too I'll come back to this one when I get time. Out of curiosity, have you tried using the similar cmdlet (which manages headers and stuff for you): It might help you get a little closer to where you want to be. I intend to come back and look at this, should anyone else not have any answers for you. |
Sorry, I have been busy the last few days, so haven't been able to look into it. I was able to attach the files to the task using
I think it was unhappy with URL encoding, which I did with a replace, but because it wasn't throwing an exception it was difficult to troubleshoot. Anyway, life can now go on! I really appreciate your help @SeniorConsulting and I hope these details help someone else in the future. |
Describe the bug
When using the Update-MgPlannerTaskDetail to update the task references with a file saved in SharePoint, the file is not attached to the task.
I am able to attach files to a task using the RestAPI. Nothing is returned after the Update-MgPlannerTaskDetail command has run.
The task is being created, the file is being downloaded and uploaded to SharePoint and I am fetching the etag from the planner task details object.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The file is attached to the task
Debug Output
DEBUG: [CmdletBeginProcessing]: - Update-MgPlannerTaskDetail begin processing with parameterSet 'Update'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'Lender Updates Automation'.
DEBUG: [Authentication]: - Scopes: [Mail.ReadWrite, Directory.ReadWrite.All, Sites.ReadWrite.All, Group.Create, Group.ReadWrite.All, Tasks.Read.All, Tasks.ReadWrite.All].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.microsoft.com/v1.0/planner/tasks/AHySj4RgeUqXdROPWY1FzpgAHiH7/details
Headers:
If-Match : W/"JzEtVGFza0RldGFpbHMgQEBAQABEQEBAQEBAQEBARCc="
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22621; en-GB),PowerShell/2023.6.0
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.6.1
client-request-id : 9c895bc4-7a1b-4aff-9f5c-b583c1c987a7
Body:
{
"references": {
"@https://4tlw7y.sharepoint.com/sites/casemanagers2/Shared%20Documents/T7uSocPUdLboAAACumcJAAA=.eml": {
"previewPriority": " !",
"@odata.type": "microsoft.graph.plannerExternalReference",
"type": "Email",
"alias": "Documentation"
}
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NoContent
Headers:
Cache-Control : no-cache
Strict-Transport-Security : max-age=31536000
request-id : 18f19662-1dcd-461a-8500-f0c170d1446c
client-request-id : 9c895bc4-7a1b-4aff-9f5c-b583c1c987a7
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"UK South","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"LN2PEPF0000669F"}}
X-ProxyCluster : neu-002.tasks.osi.office.net
X-OfficeCluster : neu-002.tasks.osi.office.net
X-Tasks-CorrelationId : 87076d66-e04b-4d60-8050-7a9731bf3b90
Date : Mon, 25 Sep 2023 10:49:09 GMT
Body:
DEBUG: [CmdletEndProcessing]: - Update-MgPlannerTaskDetail end processing.
Module Version
Script 2.6.1 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext…}
Script 2.6.1 Microsoft.Graph.Files {Add-MgDriveListContentTypeCopy, Add-MgDriveListContentTypeCopyFromContentTypeHub, Add-MgShareListContentTypeCopy, Add-MgShareListContentTypeCopyFromConte…
Script 2.6.1 Microsoft.Graph.Groups {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub, Add-MgGroupFavorite, Add-MgGroupSite…}
Script 2.6.1 Microsoft.Graph.Mail {Get-MgUserInferenceClassification, Get-MgUserInferenceClassificationOverride, Get-MgUserInferenceClassificationOverrideCount, Get-MgUserMailFolder…}
Script 2.6.1 Microsoft.Graph.Planner {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanCount…}
Script 2.6.1 Microsoft.Graph.Sites {Add-MgSite, Add-MgSiteContentTypeCopy, Add-MgSiteContentTypeCopyFromContentTypeHub, Add-MgSiteListContentTypeCopy…}
Script 2.6.1 Microsoft.Graph.Users {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrincipal…}
Script 2.6.1 Microsoft.Graph.Users.Actions {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCopyFromContentTypeHub, Clear-MgUserChatMessageReaction…}
Environment Data
PSVersion 7.3.7
PSEdition Core
GitCommitId 7.3.7
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional context
The text was updated successfully, but these errors were encountered: