GroupshareKit - upload project template does not work

I am trying to upload a project template to a Groupshare 2017 SR1 server using the Groupshare Kit.
Groupshare Kit version is the currently released one obtained through NuGets.
 
My code looks like this:
     Try

            Dim TemplateFileName As String = "C:\Users\xtomx\Documents\Studio 2017\Project Templates\Default.sdltpl"

            Dim GSClient = Await GroupShareClient.AuthenticateClient("Test", "Test_01", ServerURI, GroupShareClient.AllScopes)

            Dim Buffer = My.Computer.FileSystem.ReadAllBytes(TemplateFileName)

            Dim UploadTemplate = Await GSClient.Project.UploadProjectTemplate(templateId:="7f976661-4186-41c7-8aba-dabcb4ef879b", projectTemplate:=Buffer, templateName:="TESTTPL")

        Catch ex As Exception
               MsgBox(ex.ToString)
        End Try
 
The Request looks like this:
 
{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 AAIAACgvIyBHGKuvGZP8CxzNBUl3vlVYdxSrSObYQNr1Y5_xEtmpxNyKzVTpK-1kFNA7cUnuIWiLkwSPssDxLDZ_s-iuXQoTTW5BTj5aEEv0vDSvKkzFjashDHqI-yF2F5tBF06dD-b9InxKAfP_fuLJWsO6tCWo-ji0ITs9GvOkEUmZaovUctg8KAuUNUs8VXpw6MmH_WWk-9mHwweHQK21g1_2QtYGbNsc2qVA2QYq0daw5oK62SL0ZWGALhdc5kLp1UP4YjRQlL8agEh7iSI2ps-qz7vvsxcPVJfX0mfJFJP8xY09mYieSJZxuGHC5ifL652s8EZfVdKtMJVQSV7V5dpgioKLomEglK2CnElaK30z1HC2MD1I1DAa_8sMY8FUm07oUH70_C30qSMJ68zIE84ujAWu8pLtgmgf0E1LftiRChoGhVTV_NidPYTZY33_T8IR5MvAm18b_PSjfEXAu0s6eVtaifVWT1k1jcukPq0FW4boRDxViQcBEXfOzGquhx6eFgGoFM_PpP5oTuVhMG1yUUYHgvps7uuhUyu3sHQXfm_1ziLvgj5HzmXR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Content-Type: multipart/form-data; boundary="423fd500-f393-4904-b045-9645d3d157cd"
Content-Length: 4745
}}
 
Response:
{StatusCode: 200, ReasonPhrase: 'OK', 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 10:23:35 GMT
Content-Length: 0
}}
 
However, when my function returns, the template on the Groupshare server is not created. What am I doing wrong?
 
many thanks,
Tom
Parents
  • Former Member
    0 Former Member
    Hello Tom,

    In order to upload a project template you have to call the 'CreateTemplate()' method which looks like this:

    public async Task<string> CreateTemplate(ProjectTemplates templateRequest, byte[] rawData)
    {
    var templateId = await ApiConnection.Post<string>(ApiUrls.ProjectTemplates(), templateRequest, "application/json");
    await UploadProjectTemplate(templateId, rawData, templateRequest.Name);
    return templateId;
    }

    Here is an example of how you can use the method:

    var rawData =
    File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\SampleTemplate.sdltpl"));
    var id = Guid.NewGuid().ToString();
    var templateRequest = new ProjectTemplates(id, "kit", "", "5bdb10b8-e3a9-41ae-9e66-c154347b8d17");
    var templateId = await groupShareClient.Project.CreateTemplate(templateRequest, rawData);

    If you have any questions please feel free to contact me.

    Regards,
    Alexandru-Constantin Pascariu
Reply
  • Former Member
    0 Former Member
    Hello Tom,

    In order to upload a project template you have to call the 'CreateTemplate()' method which looks like this:

    public async Task<string> CreateTemplate(ProjectTemplates templateRequest, byte[] rawData)
    {
    var templateId = await ApiConnection.Post<string>(ApiUrls.ProjectTemplates(), templateRequest, "application/json");
    await UploadProjectTemplate(templateId, rawData, templateRequest.Name);
    return templateId;
    }

    Here is an example of how you can use the method:

    var rawData =
    File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\SampleTemplate.sdltpl"));
    var id = Guid.NewGuid().ToString();
    var templateRequest = new ProjectTemplates(id, "kit", "", "5bdb10b8-e3a9-41ae-9e66-c154347b8d17");
    var templateId = await groupShareClient.Project.CreateTemplate(templateRequest, rawData);

    If you have any questions please feel free to contact me.

    Regards,
    Alexandru-Constantin Pascariu
Children