SOLVED

Update Taskdescription via VBA - Error -2147483638 - the data required for this operation are not ye

Copper Contributor

Hello!

 

I develop an integration of planner tasks into an internal access database and there I will create a task with a important description.

 

The creation works fine, but when I update the taskdetails and there the description I get the error -2147483638 - the data required for this operation are not yet.

 

If I go stepwise through the code all works fine, but not in processing my whole code. I think that the task descriptions is not accessible that early so I have to put my code to sleep, just I can't find anything about "How long do I have to put my code to sleep?" or exists any other reason for that?

 

Update: 

First I have set Sleep 10000 for 10 seconds pause of the code and second here a screenshot in german with the error message, because the 10 seconds don't helps.

Screenshot 2023-11-02 080724.png

 

My VBA-Code to Update is the following. This function is a part of my class "Teams"

Public Function UpdateTaskDescription(pstr_ID As String, pstr_Description As String) As Boolean

On Error GoTo Err_UpdateTaskDescription

    Dim GraphAPI As New MSXML2.XMLHTTP60
    Dim str_URL As String
    Dim str_Body As String
    Dim str_ETag As String
    Dim JSON As Object
    
    str_URL = "https://graph.microsoft.com/v1.0/planner/tasks/" & pstr_ID & "/details"
    
wiederholung:
    
    str_ETag = GetETagByDetails(pstr_ID)
    
    With GraphAPI
    
        .Open "PATCH", str_URL, True
        .setRequestHeader "Content-Type", "application/json"
        .setRequestHeader "Authorization", GetAuthentication
        '.setRequestHeader "Prefer", "return=representation"        Kann mit angegeben werden, wenn das gesamte Objekt zurückkommen soll. So kommt nur 204 - No content => success
        .setRequestHeader "If-Match", str_ETag
        
        str_Body = "{" & vbNewLine
        str_Body = str_Body & Chr(34) & "description" & Chr(34) & " : " & Chr(34) & pstr_Description & Chr(34) & vbNewLine
        str_Body = str_Body & "}"
        
        .Send str_Body
    
    End With
    
    UpdateTaskDescription = GraphAPI.Status
    
Err_UpdateTaskDescription:
    If Err.Number = -2147483638 Then
        GraphAPI.abort
        GoTo wiederholung
    Else
        MsgBox Err.Number & " > " & Err.Description
    End If

End Function

 

Thanks in advance.
Axel

2 Replies
Updates;
I have change my process. In my first version I tried to create description at the same time as I create the task (not in same procedure, but when I get GraphApi.Status = 204 then I try to create the description).

Now I have split this into three separate procedures.
First: create a Task in Planner (Works fine)
Second: get the ETag from TaskDetails (Works fine)
Third: Create TaskDescription (Get the sam error as top I wrote)
best response confirmed by sb_hog (Copper Contributor)
Solution
I found the solution.....very strange.

All my procedures did not have the same way of thinking. Two of them work asynchronously and one works synchronously. After I adjusted it, it works fine

Thanks also to this post that helped me: https://stackoverflow.com/questions/38057181/the-data-necessary-to-complete-this-operation-is-not-ye...
1 best response

Accepted Solutions
best response confirmed by sb_hog (Copper Contributor)
Solution
I found the solution.....very strange.

All my procedures did not have the same way of thinking. Two of them work asynchronously and one works synchronously. After I adjusted it, it works fine

Thanks also to this post that helped me: https://stackoverflow.com/questions/38057181/the-data-necessary-to-complete-this-operation-is-not-ye...

View solution in original post