<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add custom metadata with new file upload in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109149#M30609</link>
    <description>&lt;P&gt;Alfresco model is just an xml ,so you can create the xml model file in c# and upload the xml file into Company Home/Data Dictionary/Models using cmis api.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Aug 2020 07:44:58 GMT</pubDate>
    <dc:creator>kaynezhang</dc:creator>
    <dc:date>2020-08-26T07:44:58Z</dc:date>
    <item>
      <title>Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109146#M30606</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I'm using PortCmis with AtomPub 1.1 in .Net Core and I'm trying to upload a file to Alfresco. I'm trying to set custom metadata., but I'm getting this error: Type classification is unknown!&lt;BR /&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;parameters[SessionParameter.User] = "myuser";&lt;BR /&gt;parameters[SessionParameter.Password] = "mypassword";&lt;BR /&gt;parameters[SessionParameter.AtomPubUrl] = "http://my-address-where-is-alfresco/alfresco/api/-default-/public/cmis/versions/1.1/atom";&lt;BR /&gt;parameters[SessionParameter.BindingType] = BindingType.AtomPub;&lt;BR /&gt;parameters[SessionParameter.PreemptivAuthentication] = "True";&lt;BR /&gt;&lt;BR /&gt;IDictionary&amp;lt;string, object&amp;gt; properties = new Dictionary&amp;lt;string, object&amp;gt;();&lt;BR /&gt;properties[PropertyIds.Name] = fileName;&lt;BR /&gt;&lt;BR /&gt;IList&amp;lt;string&amp;gt; secondaryTypes = new List&amp;lt;string&amp;gt;();&lt;BR /&gt;secondaryTypes.Add("custom:classification");&lt;BR /&gt;&lt;BR /&gt;properties[PropertyIds.SecondaryObjectTypeIds] = secondaryTypes;&lt;BR /&gt;properties["classification"] = "test classification";&lt;/P&gt;&lt;P&gt;After this I'm creating contentStream in a proper way and using it to create document.&lt;BR /&gt;&lt;BR /&gt;var newDoc = folder.CreateDocument(properties, contentStream, VersioningState.None);&lt;BR /&gt;&lt;BR /&gt;Does anyone has same error "Type classification is unknown!" ???&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 13:44:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109146#M30606</guid>
      <dc:creator>goranche89</dc:creator>
      <dc:date>2020-08-25T13:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109147#M30607</link>
      <description>&lt;P&gt;When adding an aspect (secondaryType), you need to add the prefix "P:" to your aspect name.&lt;/P&gt;
&lt;PRE&gt;secondaryTypes.Add("P:custom:classification");&lt;/PRE&gt;
&lt;P&gt;You need also to be sure that the model definition has been deployed in Alfresco Repository.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 14:58:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109147#M30607</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2020-08-25T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109148#M30608</link>
      <description>&lt;P&gt;Thank you! Do you know if I can define and deploy model from C# code or that can be done only in Alfresco repository by Admin?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 07:04:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109148#M30608</guid>
      <dc:creator>goranche89</dc:creator>
      <dc:date>2020-08-26T07:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109149#M30609</link>
      <description>&lt;P&gt;Alfresco model is just an xml ,so you can create the xml model file in c# and upload the xml file into Company Home/Data Dictionary/Models using cmis api.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 07:44:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109149#M30609</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2020-08-26T07:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109150#M30610</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/39620" target="_self" rel="nofollow noopener noreferrer"&gt;kaynezhang&lt;/A&gt;,&lt;BR /&gt;Is there any tutorial how to do it? I've created some xml model file, but I'm not sure where to upload it either with C# or with drag and drop.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 10:00:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109150#M30610</guid>
      <dc:creator>goranche89</dc:creator>
      <dc:date>2020-08-26T10:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109151#M30611</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/76998"&gt;@goranche89&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;There are several tutorials for creating models in Alfresco. A very recent one by &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/81146"&gt;@Jendert&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A href="https://www.alfresco.com/abn/tutorials/contract-management/" target="_self" rel="nofollow noopener noreferrer"&gt;Creating a simple Contract Management Solution&lt;/A&gt;, is a very good introduction.&amp;nbsp; &amp;nbsp;There are also Jeff Pott's &lt;A href="https://ecmarchitect.com/alfresco-developer-series" target="_self" rel="nofollow noopener noreferrer"&gt;Alfresco Developer Tutorials&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;With regard to using the Alfresco ReST API, there's &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-blog/v1-rest-api-10-things-you-should-know/ba-p/287692" target="_self" rel="nofollow noopener noreferrer"&gt;Gavin Cornwell's blog series&lt;/A&gt;. &amp;amp; also&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/81146"&gt;@Jendert&lt;/A&gt;&amp;nbsp;&lt;A href="https://github.com/Alfresco/tutorials/blob/api-tutorial/docs/api-tutorial/introduction.md" target="_self" rel="nofollow noopener noreferrer"&gt;API tutorial&lt;/A&gt; (still a work in progress).&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 10:38:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109151#M30611</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-08-26T10:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109152#M30612</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I've uploaded an xml to Repository/Models. I like that approach to upload xml and than use it as a custom model. But I don't know is that enough or I must do something else? I see that in Admin Tools there is no my custom model, and that other approach is to simply create it with wizard., but I don't want that.&lt;BR /&gt;So to recapitulate, I've uploaded my xml model to Models and I can see that document as document in xml format. What is next step to be able to use that custom model for uploading files with aspects defined in that model?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 11:13:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109152#M30612</guid>
      <dc:creator>goranche89</dc:creator>
      <dc:date>2020-08-26T11:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109153#M30613</link>
      <description>&lt;P&gt;Yes ,upload your xml to&amp;nbsp;&lt;SPAN&gt;Repository/Models. and you also need to&amp;nbsp;set cmis&lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://connect.hyland.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;bjectTypeId to D:cm:dictionaryModel,and cm:modelActive property to true. Then you can use your types and aspects defined in your model.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 04:05:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109153#M30613</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2020-08-27T04:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109154#M30614</link>
      <description>&lt;P&gt;Thank you all! It works! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 09:31:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109154#M30614</guid>
      <dc:creator>goranche89</dc:creator>
      <dc:date>2020-08-27T09:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add custom metadata with new file upload</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109155#M30615</link>
      <description>&lt;P&gt;This is the solution that worked for me. I also had the same question and issue - Using REST, to upload file alongwith metadata here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/64176613/alfresco-how-to-add-set-content-of-the-file-while-doing-post-using-resttemplat/65188096#65188096" target="_blank" rel="noopener nofollow noreferrer"&gt;https://stackoverflow.com/questions/64176613/alfresco-how-to-add-set-content-of-the-file-while-doing-post-using-resttemplat/65188096#65188096&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I was trying to get it done using Spring RestTemplate but couldne make it. So I reached Alfresco support. And those guyz are awesome. They gave me the solution that worked flawlessly.&lt;/P&gt;&lt;P&gt;Here is the solution:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;private&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;static&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;postFileAndMetadataToAlfresco&lt;/SPAN&gt;&lt;SPAN class="hljs-params"&gt;()&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;throws&lt;/SPAN&gt; IOException &lt;/SPAN&gt;{

        CloseableHttpClient httpClient = HttpClients.createDefault();
        HttpPost httpPost = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; HttpPost(POST_URL);
        UsernamePasswordCredentials creds = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; UsernamePasswordCredentials (&lt;SPAN class="hljs-string"&gt;"admin"&lt;/SPAN&gt;,&lt;SPAN class="hljs-string"&gt;"adminpswd"&lt;/SPAN&gt;);
        httpPost.addHeader (&lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; BasicScheme().authenticate(creds,httpPost, &lt;SPAN class="hljs-keyword"&gt;null&lt;/SPAN&gt;));

        File payload = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; File (&lt;SPAN class="hljs-string"&gt;"/path/to/my/file.pdf"&lt;/SPAN&gt;);

        MultipartEntityBuilder builder = MultipartEntityBuilder.create(); &lt;SPAN class="hljs-comment"&gt;// Entity builder&lt;/SPAN&gt;

        builder.addPart(&lt;SPAN class="hljs-string"&gt;"filedata"&lt;/SPAN&gt;, &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; FileBody(payload)); &lt;SPAN class="hljs-comment"&gt;// this is where I was struggling&lt;/SPAN&gt;
        builder.addTextBody (&lt;SPAN class="hljs-string"&gt;"name"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"thenamegoeshere"&lt;/SPAN&gt;);
        builder.addTextBody (&lt;SPAN class="hljs-string"&gt;"foo"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"foo"&lt;/SPAN&gt;);
        builder.addTextBody (&lt;SPAN class="hljs-string"&gt;"bar"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"bar"&lt;/SPAN&gt;);
        builder.addTextBody (&lt;SPAN class="hljs-string"&gt;"description"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"descriptiongoeshere"&lt;/SPAN&gt;);

        builder.addTextBody (&lt;SPAN class="hljs-string"&gt;"overwrite"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"true"&lt;/SPAN&gt;);

        HttpEntity entity = builder.build();

        httpPost.setHeader(&lt;SPAN class="hljs-string"&gt;"Accept"&lt;/SPAN&gt;,&lt;SPAN class="hljs-string"&gt;"application/json"&lt;/SPAN&gt;);
        httpPost.setEntity(entity);

        CloseableHttpResponse response = client.execute(httpPost); &lt;SPAN class="hljs-comment"&gt;// Post the request and get response&lt;/SPAN&gt;

        System.out.println(response.toString()); &lt;SPAN class="hljs-comment"&gt;// Response print to console&lt;/SPAN&gt;

        client.close();  &lt;SPAN class="hljs-comment"&gt;// close the client&lt;/SPAN&gt;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hoping it might help someone like me.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 19:33:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-custom-metadata-with-new-file-upload/m-p/109155#M30615</guid>
      <dc:creator>ajkr195</dc:creator>
      <dc:date>2020-12-07T19:33:34Z</dc:date>
    </item>
  </channel>
</rss>

