ggrGroupshare Kit: Trying to upload a project template fails

Hello, 
 
I am trying to upload a project template to a Groupshare 2017 SR1 server using the Groupshare Kit and I receive error 400 in the response. Groupshare Kit version is the currently released one obtained through NuGets.
 
My code looks like this:
 
Dim ServerURI As New System.Uri("http://myserver" & "/Suborg")
Dim GSClient = AwaitGroupShareClient.AuthenticateClient("Test", "Test_01", ServerURI, GroupShareClient.AllScopes)
        Dim TemplateFileName As String = "Path to the project template goes here"
        Try
            'Reading template file into byte array
            Dim FS As FileStream
            FS = New FileStream(TemplateFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
            Dim Buffer(FS.Length) As Byte
            If FS.Length > 0 Then
                FS.Read(Buffer, 0, FS.Length - 1)
                FS.Close()
                Dim UploadTemplate = Await GSClient.Project.UploadProjectTemplate(templateId:="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", projectTemplate:=Buffer, templateName:="TESTTPL")
                Buffer = Nothing
                FS = Nothing
            Else
                MsgBox("Template file was empty")
            End If
        Catch ex As Exception
               MsgBox(ex.ToString)
        End Try
 
If you look at the line in bold that is where the request to POST the new template is issued and where I receive a 400 error back. 
 
If I step through the groupshare kit code that is executed, I can see this is my request that is sent to Groupshare:
 
{Method: POST, RequestUri: 'winserv2016/.../upload', Version: 1.1, Content: System.Net.Http.MultipartFormDataContent, Headers:
{
  User-Agent: (WindowsRT 8+; unknown; de-DE; GroupShare kit)
  Authorization: Bearer AAIAAHPP-0pgxK9FCkBh8HAyfS8uuUFRP8l0u0PCv_xUJ11ovWbUT_jICRDLzGZF2vSkI-wTMiVUtyWovB3RDfTZJbTenhy7ljSBct_TRhUrNUhCGAUa3wVLohnaggsiZCnvL4IwvQ4qCQmB3O7pMQcQ2kf-pb6SpR43gQjFWbs3dxiT_b87i1CIsDqbeGyAZblzOtB20t7B7EXqL_8sBmdZdlgKMFbCuEMl14JvGQ6x48i40N-R0CwQILhqmJ37L-C8kqmVtcQU0F-g2DbQsC1FKX7kA7UDIza3s2KFx3OYC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Jx-v0LE0_CII0DUgAJdbSSa5DIc2PaWQ2TeYUMPzNbNspnFVjEOYvORR1BSMBRhk-uxO0adyIoEQTP4EkB75dZiw3vxExTPueyThgVmEnI4PO7GVote-grMrbaX47A9SFoCEWANTj24RhQXYxCIKHWKYbvWCQRG40z1meucj5ketQGG7lM8f5dqRAfrVn4GJmqst43BEmamafmkstPj8pofPnwxrA1VDTqvsTVavReaL9AvaYGHQ
  Accept: application/json
  Content-Type: multipart/form-data; boundary="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}}
 
The Response looks like this:
 
{StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Server: Microsoft-IIS/10.0
  X-Powered-By: ARR/3.0
  X-Powered-By: ASP.NET
  Date: Fri, 11 May 2018 08:27:54 GMT
  Content-Length: 246
  Content-Type: application/json; charset=utf-8
}}
 
"{\"Message\":\"Failed to load project template from 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Temp\\\\tmp1ADF.tmp': \\r\\nThere is an error in XML document (87, 18).\\r\\n'\\u0000' is an unexpected token. The expected token is '>'. Line 87, position 18.\"}"
 
If I look at my template file, Line 87, position 18 is the closing > of the root element:
 
Screenshot of an XML file opened in EmEditor with a focus on line 87, which shows the closing tag of the root element.
 
 
Can you tell me, why the Groupshare Kit returns this error?
 
Many thanks,
Tom 
 


Generated Image Alt-Text
[edited by: RWS Community AI at 4:24 AM (GMT 0) on 15 Nov 2024]
Parents Reply Children
No Data