Operation() public method

Creates a new instance of an Automation Operation.
public Operation ( string id ) : Operation
id string The operation's id.
return Operation
Exemplo n.º 1
0
        public BlobUpload()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            blobsFolder = (Document)client.Operation("Document.Create")
                                                   .SetInput("doc:/")
                                                   .SetParameter("type", "Folder")
                                                   .SetParameter("name", "TestBlobs")
                                                   .SetParameter("properties", new ParamProperties { { "dc:title", "Blob Operations" } })
                                                   .Execute()
                                                   .Result;

            blobContainer = (Document)client.Operation("Document.Create")
                                            .SetInput("doc:" + blobsFolder.Path)
                                            .SetParameter("type", "File")
                                            .SetParameter("name", "MyFileWithPics")
                                            .SetParameter("properties", new ParamProperties { { "dc:title", "My File With Pics" } })
                                            .Execute()
                                            .Result;
        }
Exemplo n.º 2
0
        public Adapters()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            folder = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "TestFolder4",
                Properties = new Properties { { "dc:title", "Adapter Tests" } }
            }).Result;
            Assert.NotNull(folder);

            Document document = (Document)client.DocumentFromPath(folder.Path).Post(new Document
            {
                Type = "File",
                Name = "TestFile1",
                Properties = new Properties { { "dc:title", "File 1" } }
            }).Result;
            Assert.NotNull(document);

            document = (Document)client.DocumentFromPath(folder.Path).Post(new Document
            {
                Type = "File",
                Name = "TestFIle2",
                Properties = new Properties { { "dc:title", "File 2" } }
            }).Result;
            Assert.NotNull(document);

            Blob blob = Blob.FromFile("Puppy.docx");
            document = (Document)client.Operation("FileManager.Import")
                                       .SetInput(blob)
                                       .SetContext("currentDocument", folder.Path)
                                       .Execute()
                                       .Result;
        }
Exemplo n.º 3
0
        private async System.Threading.Tasks.Task UpdateServerInfo()
        {
            StartProgressRing();
            client = new Client(Properties.Settings.Default.ServerURL,
                                new NuxeoClient.Authorization(Properties.Settings.Default.Username,
                                                              Properties.Settings.Default.Password))
                                                              .AddDefaultSchema("dublincore");

            webClient = new WebClient();
            webClient.Headers[HttpRequestHeader.Authorization] = client.Authorization.GenerateAuthorizationParameter();

            Title = Properties.Settings.Default.ServerURL;

            try
            {
                EntityList<Entity> ents = (EntityList<Entity>)await client.Operation("UserGroup.Suggestion").SetParameter("searchType", "USER_TYPE").Execute();
                userList.Clear();
                foreach (Entity entity in ents)
                {
                    string username = ((UnknowEntity)entity).Json["username"].ToObject<string>();
                    if (username != Properties.Settings.Default.Username)
                    {
                        userList.Add(new UserViewModel(username));
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayError("Could not get user list", ex);
            }
            StopProgressRing();
        }