08-08-2011 08:13 AM
POST http://<host>:<port>/<contextPath>/<servicePath>/api/path/Workspace/SpacesStore/Company%20Home?alf_method=DELETE
http://localhost:8080/alfresco/d/d/workspace/SpacesStore/affbf420-df19-4dd5-a509-d72e8e14e1fd/test.p...
Ich denke, wenn ich das oben angegebene Format nutze, so müsste ich dann an die gefundene Url nur ein "?alf_method=DELETE" anhängen, somit wäre die Url für den HttpRequest dannhttp://localhost:8080/alfresco/d/d/workspace/SpacesStore/affbf420-df19-4dd5-a509-d72e8e14e1fd/test.p...
. Das allerdings funktioniert nicht.08-08-2011 09:30 AM
http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/affbf420-df19-4dd5-a509-d72e8e14e1fd...
VG, Jan
08-08-2011 10:23 AM
08-08-2011 10:54 AM
/alfresco/s/slingshot/doclib/action/file/node/{store_type}/{store_id}/{id}?alf_method=DELETE
benutzen08-09-2011 02:38 AM
08-09-2011 03:08 AM
08-09-2011 04:36 AM
private void toolStripButton2_Click(object sender, EventArgs e)
{
int iPosStart;
int iPosEnd;
int iLen;
string strUri;
string strTemp;
WebRequest webRequest;
//…u.a. ermitteln welche Datei der User gewählt hat.
//…
//login und ermitteln des Tickets
strUri = "http://localhost:8080/alfresco/service/api/login"; //hier für Demo hardcodiert; die Pfade stehen sonst in settings
strTemp = strTemp + "?u=admin&pw=protest";
webRequest = WebRequest.Create(strUri);
strResult = retrieveFromURL(webRequest);
//extrahieren des Tickets
iPosStart = strResult.IndexOf("TICKET_", 0);
iPosEnd = strResult.IndexOf("</ticket>", 0);
iLen = iPosEnd - iPosStart;
strTicket = strHtmlContent.Substring(iPosStart, iLen);
//nun Url zusammensetzen und senden
strFile = "7aea13ce-b02a-44ef-a506-98f089521d3e/ArchiveTest.pdf"; //wird in der Anwendung ermittelt
strUri = string.Concat("http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/", strFile, "?alf_method=delete&alf_ticket=", strTicket);
webRequest = WebRequest.Create(strUri);
//webRequest.Method = "POST"; //sobald diese Zeile aktiviert ist, kommt ein Fehler 500: internal server error zurück
strResult = retrieveFromURL(webRequest);
}
private String retrieveFromURL(WebRequest request)
{
// 1. Get the Web Response Object from the request
WebResponse response = request.GetResponse(); //hier erhalte ich den Fehler 500
// 2. Get the Stream Object from the response
Stream responseStream = response.GetResponseStream();
// 3. Create a stream reader and associate it with the stream object
StreamReader reader = new StreamReader(responseStream);
// 4. read the entire stream
return reader.ReadToEnd();
}// end retrieveFromURL method
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:app=\"http://www.w3.org/2007/app\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:alf=\"http://www.alfresco.org\">
<author><name>admin</name></author>
<content type=\"application/pdf\" src=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...><id>urn:uuid:7aea13ce-b02a-44ef-a506-98f089521d3e</id>
<link rel=\"self\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"enclosure\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e..." type=\"application/pdf\"/>
<link rel=\"edit\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"edit-media\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e..." type=\"application/pdf\"/>
<link rel=\"http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"http://docs.oasis-open.org/ns/cmis/link/200908/relationships\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"http://docs.oasis-open.org/ns/cmis/link/200908/policies\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"http://docs.oasis-open.org/ns/cmis/link/200908/acl\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"up\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e..." type=\"application/atom+xml;type=feed\"/>
<link rel=\"version-history\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"current-version\" href=\"http://localhost:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/7aea13ce-b02a-44ef-a506-98f089521d3e...>
<link rel=\"describedby\" href=\"http://localhost:8080/alfresco/s/cmis/type/D:ws:article\'/>
<link rel=\"service\" href=\"http://localhost:8080/alfresco/s/cmis\'/>
<published>2011-08-08T16:08:03.651+02:00</published>
<summary></summary>
<title>ArchiveTest.pdf</title>
<updated>2011-08-08T16:08:06.875+02:00</updated>
<app:edited>2011-08-08T16:08:06.875+02:00</app:edited>
<alf:icon>http://localhost:8080/alfresco/images/filetypes/pdf.gif</alf:icon>
<cmisra:object>
<cmis:properties>
<cmis:propertyBoolean propertyDefinitionId=\"cmis:isLatestMajorVersion\" displayName=\"Is Latest Major Version\" queryName=\"cmis:isLatestMajorVersion\"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyId propertyDefinitionId=\"cmis:contentStreamId\" displayName=\"Content Stream Id\" queryName=\"cmis:contentStreamId\"><cmis:value>store://2011/8/8/16/8/b4c01374-be73-4b63-b39b-a40019e19532.bin</cmis:value></cmis:propertyId>
<cmis:propertyInteger propertyDefinitionId=\"cmis:contentStreamLength\" displayName=\"Content Stream Length\" queryName=\"cmis:contentStreamLength\"><cmis:value>3712</cmis:value></cmis:propertyInteger>
<cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\" displayName=\"Object Type Id\" queryName=\"cmis:objectTypeId\"><cmis:value>D:ws:article</cmis:value></cmis:propertyId>
<cmis:propertyString propertyDefinitionId=\"cmis:versionSeriesCheckedOutBy\" displayName=\"Version Series Checked Out By\" queryName=\"cmis:versionSeriesCheckedOutBy\"/>
<cmis:propertyId propertyDefinitionId=\"cmis:versionSeriesCheckedOutId\" displayName=\"Version Series Checked Out Id\" queryName=\"cmis:versionSeriesCheckedOutId\"/>
<cmis:propertyString propertyDefinitionId=\"cmis:name\" displayName=\"Name\" queryName=\"cmis:name\"><cmis:value>ArchiveTest.pdf</cmis:value></cmis:propertyString>
<cmis:propertyString propertyDefinitionId=\"cmis:contentStreamMimeType\" displayName=\"Content Stream MIME Type\" queryName=\"cmis:contentStreamMimeType\"><cmis:value>application/pdf</cmis:value></cmis:propertyString>
<cmis:propertyId propertyDefinitionId=\"cmis:versionSeriesId\" displayName=\"Version series id\" queryName=\"cmis:versionSeriesId\"><cmis:value>workspace://SpacesStore/7aea13ce-b02a-44ef-a506-98f089521d3e</cmis:value></cmis:propertyId>
<cmis:propertyDateTime propertyDefinitionId=\"cmis:creationDate\" displayName=\"Creation Date\" queryName=\"cmis:creationDate\"><cmis:value>2011-08-08T16:08:03.651+02:00</cmis:value></cmis:propertyDateTime>
<cmis:propertyString propertyDefinitionId=\"cmis:changeToken\" displayName=\"Change token\" queryName=\"cmis:changeToken\"/>
<cmis:propertyBoolean propertyDefinitionId=\"cmis:isLatestVersion\" displayName=\"Is Latest Version\" queryName=\"cmis:isLatestVersion\"><cmis:value>true</cmis:value></cmis:propertyBoolean>
<cmis:propertyString propertyDefinitionId=\"cmis:versionLabel\" displayName=\"Version Label\" queryName=\"cmis:versionLabel\"><cmis:value>0.0</cmis:value></cmis:propertyString>
<cmis:propertyBoolean propertyDefinitionId=\"cmis:isVersionSeriesCheckedOut\" displayName=\"Is Version Series Checked Out\" queryName=\"cmis:isVersionSeriesCheckedOut\"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyString propertyDefinitionId=\"cmis:lastModifiedBy\" displayName=\"Last Modified By\" queryName=\"cmis:lastModifiedBy\"><cmis:value>admin</cmis:value></cmis:propertyString>
<cmis:propertyString propertyDefinitionId=\"cmis:createdBy\" displayName=\"Created by\" queryName=\"cmis:createdBy\"><cmis:value>admin</cmis:value></cmis:propertyString>
<cmis:propertyString propertyDefinitionId=\"cmis:checkinComment\" displayName=\"Checkin Comment\" queryName=\"cmis:checkinComment\"/>
<cmis:propertyId propertyDefinitionId=\"cmis:objectId\" displayName=\"Object Id\" queryName=\"cmis:objectId\"><cmis:value>workspace://SpacesStore/7aea13ce-b02a-44ef-a506-98f089521d3e</cmis:value></cmis:propertyId>
<cmis:propertyBoolean propertyDefinitionId=\"cmis:isMajorVersion\" displayName=\"Is Major Version\" queryName=\"cmis:isMajorVersion\"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyBoolean propertyDefinitionId=\"cmis:isImmutable\" displayName=\"Is Immutable\" queryName=\"cmis:isImmutable\"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyId propertyDefinitionId=\"cmis:baseTypeId\" displayName=\"Base Type Id\" queryName=\"cmis:baseTypeId\"><cmis:value>cmis:document</cmis:value></cmis:propertyId>
<cmis:propertyDateTime propertyDefinitionId=\"cmis:lastModificationDate\" displayName=\"Last Modified Date\" queryName=\"cmis:lastModificationDate\"><cmis:value>2011-08-08T16:08:06.875+02:00</cmis:value></cmis:propertyDateTime>
<cmis:propertyString propertyDefinitionId=\"cmis:contentStreamFileName\" displayName=\"Content Stream Filename\" queryName=\"cmis:contentStreamFileName\"><cmis:value>ArchiveTest.pdf</cmis:value></cmis:propertyString>
<alf:aspects>
<alf:appliedAspects>P:cm:titled</alf:appliedAspects>
<alf:appliedAspects>P:cm:author</alf:appliedAspects>
<alf:properties>
<cmis:propertyString propertyDefinitionId=\"cm:description\" displayName=\"Description\" queryName=\"cm:description\"><cmis:value></cmis:value></cmis:propertyString>
<cmis:propertyString propertyDefinitionId=\"cm:title\" displayName=\"Title\" queryName=\"cm:title\"><cmis:value>ArchiveTest.pdf</cmis:value></cmis:propertyString>
<cmis:propertyString propertyDefinitionId=\"cm:author\" displayName=\"Author\" queryName=\"cm:author\"><cmis:value>martin.niewerth</cmis:value></cmis:propertyString>
</alf:properties>
</alf:aspects>
</cmis:properties>
</cmisra:object>
<cmisra:pathSegment>ArchiveTest.pdf</cmisra:pathSegment>
</entry>
08-09-2011 05:11 AM
//Nicht strFile = "7aea13ce-b02a-44ef-a506-98f089521d3e/ArchiveTest.pdf"
strFile = "7aea13ce-b02a-44ef-a506-98f089521d3e"; //der Name interessiert beim löschen nicht
und mach ein POST mit alf_method=delete oder noch besser direkt ein delete, beim GET bekommst du lediglich die Infos zum dokument zurück…08-09-2011 07:29 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.