How to upload files in alfresco using Windows Forms ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2014 05:04 AM
Hi Team,
How to upload documents in alfresco using Windows Forms ?
Please suggest me how to work with alfresco cmis in windows environment ?
Thanks,
Divya Palivela
How to upload documents in alfresco using Windows Forms ?
Please suggest me how to work with alfresco cmis in windows environment ?
Thanks,
Divya Palivela
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2014 01:48 AM
———————————————————-
How to upload and download files to alfresco using Java Class,
I need a java class for the below items with different methods, could you please provide
1. Upload File along with Meta Data
public void uploadFile( ) {
}
2. Download File along with Meta Data
public void downloadFile( ) {
}
3. Search File By Name
public void SearchFileByName( ) {
}
4. Search File with Meta Data
public void SearchFileWithMetaData( ) {
}
5. List GUIDs for Files matching the criteria
public void listOfGuids( ) {
}
6. Search File by GUID
public void searchGuid( ) {
}
……………………………..
I have implemented in the below class for uploading to Alfresco,
i need similarly in different methods for the other items mentioned above,
could you please help on this,
………………………………..
public class AlfrescoUtil {
public static void main(String args[]) throws Exception {
String fileName = "upload.jpg";
WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/soapapi");
AuthenticationUtils.startSession("admin", "admin");
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
RepositoryServiceSoapBindingStub repositoryService =WebServiceFactory.getRepositoryService();
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
String parentSpace = "/app:company_home/cm:ACH_Space";
ParentReference parentReference = new ParentReference (storeRef, null, parentSpace, Constants.ASSOC_CONTAINS, null);
parentReference.setChildName("cm:"+ fileName);
NamedValue[] contentProps = new NamedValue[3];
contentProps[0] = Utils.createNamedValue(Constants.PROP_TITLE,fileName);
contentProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, fileName);
contentProps[2] = Utils.createNamedValue(Constants.PROP_NAME, fileName);
NamedValue[] aspectProps = new NamedValue[3];
aspectProps[0] = Utils.createNamedValue("{mandate}UMRN","18062014_01");
aspectProps[1] = Utils.createNamedValue("{mandate}IRN", "18062014_01");
aspectProps[2] = Utils.createNamedValue("{mandate}status", "TDS");
CMLAddAspect addAspect = new CMLAddAspect();
addAspect.setAspect("{mandate}mandateImage");
addAspect.setProperty(aspectProps);
addAspect.setWhere(new Predicate(new Reference[] { parentReference }, null, null));
addAspect.setWhere_id("1");
CMLCreate create = new CMLCreate("1", parentReference, parentReference.getUuid(), Constants.ASSOC_CONTAINS,null, Constants.PROP_CONTENT, contentProps);
CML cml = new CML();
cml.setCreate(new CMLCreate[] { create });
cml.setAddAspect(new CMLAddAspect[] { addAspect });
UpdateResult[] result1 = repositoryService.update(cml);
Reference content = result1[0].getDestination();
FileInputStream is = new FileInputStream("C:\\Users\\0021083\\Desktop\\PostGoLive4.jpg");
byte[] bytes = ContentUtils.convertToByteArray(is);
ContentFormat format = new ContentFormat("image/jpeg", "UTF-8");
contentService.write(content, Constants.PROP_CONTENT, bytes,format);
System.out.println("File Uploaded Successfully");
}
How to upload and download files to alfresco using Java Class,
I need a java class for the below items with different methods, could you please provide
1. Upload File along with Meta Data
public void uploadFile( ) {
}
2. Download File along with Meta Data
public void downloadFile( ) {
}
3. Search File By Name
public void SearchFileByName( ) {
}
4. Search File with Meta Data
public void SearchFileWithMetaData( ) {
}
5. List GUIDs for Files matching the criteria
public void listOfGuids( ) {
}
6. Search File by GUID
public void searchGuid( ) {
}
……………………………..
I have implemented in the below class for uploading to Alfresco,
i need similarly in different methods for the other items mentioned above,
could you please help on this,
………………………………..
public class AlfrescoUtil {
public static void main(String args[]) throws Exception {
String fileName = "upload.jpg";
WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/soapapi");
AuthenticationUtils.startSession("admin", "admin");
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
RepositoryServiceSoapBindingStub repositoryService =WebServiceFactory.getRepositoryService();
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
String parentSpace = "/app:company_home/cm:ACH_Space";
ParentReference parentReference = new ParentReference (storeRef, null, parentSpace, Constants.ASSOC_CONTAINS, null);
parentReference.setChildName("cm:"+ fileName);
NamedValue[] contentProps = new NamedValue[3];
contentProps[0] = Utils.createNamedValue(Constants.PROP_TITLE,fileName);
contentProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, fileName);
contentProps[2] = Utils.createNamedValue(Constants.PROP_NAME, fileName);
NamedValue[] aspectProps = new NamedValue[3];
aspectProps[0] = Utils.createNamedValue("{mandate}UMRN","18062014_01");
aspectProps[1] = Utils.createNamedValue("{mandate}IRN", "18062014_01");
aspectProps[2] = Utils.createNamedValue("{mandate}status", "TDS");
CMLAddAspect addAspect = new CMLAddAspect();
addAspect.setAspect("{mandate}mandateImage");
addAspect.setProperty(aspectProps);
addAspect.setWhere(new Predicate(new Reference[] { parentReference }, null, null));
addAspect.setWhere_id("1");
CMLCreate create = new CMLCreate("1", parentReference, parentReference.getUuid(), Constants.ASSOC_CONTAINS,null, Constants.PROP_CONTENT, contentProps);
CML cml = new CML();
cml.setCreate(new CMLCreate[] { create });
cml.setAddAspect(new CMLAddAspect[] { addAspect });
UpdateResult[] result1 = repositoryService.update(cml);
Reference content = result1[0].getDestination();
FileInputStream is = new FileInputStream("C:\\Users\\0021083\\Desktop\\PostGoLive4.jpg");
byte[] bytes = ContentUtils.convertToByteArray(is);
ContentFormat format = new ContentFormat("image/jpeg", "UTF-8");
contentService.write(content, Constants.PROP_CONTENT, bytes,format);
System.out.println("File Uploaded Successfully");
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2014 02:03 AM
Hi Divya,
Please let me know, do you want use .net C# or VB.net windows forms?
In this case,you need use DOTCMIS.
Please refer the below links.
http://chemistry.apache.org/dotnet/dotcmis.html
http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html
Please let me know, do you want use .net C# or VB.net windows forms?
In this case,you need use DOTCMIS.
Please refer the below links.
http://chemistry.apache.org/dotnet/dotcmis.html
http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2015 01:38 PM
Hi,
I know its pretty old thread.
But I am also facing the same issue as mentioned above.
My requirement is to develop a website to perform upload,download using alfresco restful API in C#/VB without DOTCOMS.
Please suggest me how to work in this scenario.
Best Regards,
R.Dhamayandhi
I know its pretty old thread.
But I am also facing the same issue as mentioned above.
My requirement is to develop a website to perform upload,download using alfresco restful API in C#/VB without DOTCOMS.
Please suggest me how to work in this scenario.
Best Regards,
R.Dhamayandhi
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2016 10:29 AM
Hi,
did you find the answer for your issue !? i want to upload a file using .NET C# to alfresco upload api.
If you found can you help me send me a example ?
Thanks in advance
Igor
did you find the answer for your issue !? i want to upload a file using .NET C# to alfresco upload api.
If you found can you help me send me a example ?
Thanks in advance
Igor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2016 01:04 PM
Hi,
Here is the sample C# which I have used to upload an image file .net to Alfresco Repo using CMIS.
Here is the sample C# which I have used to upload an image file .net to Alfresco Repo using CMIS.
IDictionary<string, object> DocumentProperties = new Dictionary<string, object>();DocumentProperties[PropertyIds.Name] = FileName;DocumentProperties[PropertyIds.ObjectTypeId] = "cmis:document";Stream temp = new MemoryStream(content);ContentStream contentStream = new ContentStream();contentStream.FileName = FileName;contentStream.MimeType = "image/jpeg";contentStream.Length = content.Length;contentStream.Stream = new MemoryStream(content);IDocument doc = documentTypeFolderRef.CreateDocument(DocumentProperties, contentStream, DotCMIS.Enums.VersioningState.Major);