Exemple #1
0
        private void TestResizeOriginal(int nodeId)
        {
            try
            {
                imagelinks.ImageLinksClient imageLinksClient = new imagelinks.ImageLinksClient();
                imageLinksClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(imagelinksUri);

                imagelinks.OTAuthentication imagelinksAuthentication = new imagelinks.OTAuthentication();

                String fileName = @"C:\Users\Public\Pictures\Sample Pictures\preview.jpg";
                ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                FileInfo testFileInfo = new FileInfo(fileName);
                testFileAtts.CreatedDate  = testFileInfo.CreationTime;
                testFileAtts.FileName     = testFileInfo.Name;
                testFileAtts.FileSize     = testFileInfo.Length;
                testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                documentManagementClient.Endpoint.Address            = new System.ServiceModel.EndpointAddress(documentManagementUri);
                documentManagementAuthentication                     = new ContentServerDocumentManagement.OTAuthentication();
                documentManagementAuthentication.AuthenticationToken = contentServerToken;

                ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, nodeId);
                imagelinksAuthentication.AuthenticationToken = contentServerToken;
                imagelinks.ResizeOriginalResult resizeOriginalResult = imageLinksClient.ResizeOriginal(ref imagelinksAuthentication, nodeId, new imagelinks.Metadata());

                Stream content = File.Open(fileName, FileMode.Open);

                ContentServerContentService.ContentServiceClient contentServiceClient = new ContentServerContentService.ContentServiceClient();
                contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                ContentServerContentService.OTAuthentication contentServiceAuthentication = new ContentServerContentService.OTAuthentication();

                contentServiceAuthentication.AuthenticationToken = contentServerToken;
                string s = contentServiceClient.UploadContent(ref contentServiceAuthentication, resizeOriginalResult.OriginalContext, testFileAtts, content);
                content.Close(); content.Dispose();
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        private void TestResizeOriginal(int nodeId)
        {
            try
            {
                imagelinks.ImageLinksClient imageLinksClient = new imagelinks.ImageLinksClient();
                imageLinksClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(imagelinksUri);

                imagelinks.OTAuthentication imagelinksAuthentication = new imagelinks.OTAuthentication();

                String fileName = @"C:\Users\Public\Pictures\Sample Pictures\preview.jpg";
                ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                FileInfo testFileInfo = new FileInfo(fileName);
                testFileAtts.CreatedDate = testFileInfo.CreationTime;
                testFileAtts.FileName = testFileInfo.Name;
                testFileAtts.FileSize = testFileInfo.Length;
                testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                documentManagementClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(documentManagementUri);
                documentManagementAuthentication = new ContentServerDocumentManagement.OTAuthentication();
                documentManagementAuthentication.AuthenticationToken = contentServerToken;

                ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, nodeId);
                imagelinksAuthentication.AuthenticationToken = contentServerToken;
                imagelinks.ResizeOriginalResult resizeOriginalResult = imageLinksClient.ResizeOriginal(ref imagelinksAuthentication, nodeId, new imagelinks.Metadata());

                Stream content = File.Open(fileName, FileMode.Open);

                ContentServerContentService.ContentServiceClient contentServiceClient = new ContentServerContentService.ContentServiceClient();
                contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                ContentServerContentService.OTAuthentication contentServiceAuthentication = new ContentServerContentService.OTAuthentication();

                contentServiceAuthentication.AuthenticationToken = contentServerToken;
                string s = contentServiceClient.UploadContent(ref contentServiceAuthentication, resizeOriginalResult.OriginalContext, testFileAtts, content);
                content.Close(); content.Dispose();
            }
            catch (Exception ex)
            {

            }
        }