Exemple #1
0
        public static IPolicyLocationItem CreateFolder(IAssetService2 assetServiceClient, ItemId parentId, string name, string desc)
        {
            Folder testFolder = new Folder();
            testFolder.Name = name;
            testFolder.Description = desc;
            testFolder.ItemId = new ItemId();
            testFolder.AssetType = Workshare.Server.Proxies.Asset2Proxy.Type.Policy;
            testFolder.ParentFolderId = parentId;

            FoldersRequest request = new FoldersRequest();
            request.Folders = new Folders();
            request.Folders.Add(testFolder);

            FoldersResponse response = assetServiceClient.CreateFolders(request);
            if (0 == response.Folders.Count)
                throw new Exception("Failed to create test folder");

			return FindFolder(assetServiceClient, response.Folders[0].Path);
        }
Exemple #2
0
        public static IPolicyLocationItem FindFolder(IAssetService2 assetServiceClient, string folderPath, bool includeAssets)
        {
            FindFoldersRequest request = new FindFoldersRequest();
            request.AssetType = Workshare.Server.Proxies.Asset2Proxy.Type.Policy;
            request.IncludeChildFolders = true;
            request.IncludeAssets = includeAssets;
            request.Path = folderPath;

			FoldersResponse response = assetServiceClient.FindFolders(request);
            if (0 == response.Folders.Count)
                throw new Exception(string.Format("Could not find  folder [{0}]", folderPath));

            return new PolicyLocationItem(response.Folders[0]);
        }
Exemple #3
0
        public static IPolicyLocationItem FindFolder(IAssetService2 assetServiceClient, string folderPath)
        {
			return FindFolder(assetServiceClient, folderPath, false);
        }
Exemple #4
0
        public static void DeleteDraft(IAssetService2 assetServiceClient, ItemId itemId)
        { 
            ItemIdsRequest request = new ItemIdsRequest();
            request.ItemIds = new ItemIds();
            request.ItemIds.Add(itemId);

			assetServiceClient.RemoveDrafts(request);
        }
Exemple #5
0
        public static Asset FindAssetByNameInDrafts(IAssetService2 assetServiceClient, string fileId)
        {
            FindDraftAssetsRequest request = new FindDraftAssetsRequest();
            request.AssetType = Workshare.Server.Proxies.Asset2Proxy.Type.Policy;
            request.IncludeContents = true;

			AssetsResponse response = assetServiceClient.FindDraftAssets(request);
            if (null == response)
                throw new NullReferenceException("Invalid response object returned by FindDraftAssets");

            foreach (Asset asset in response.Assets)
            {
                if (fileId == asset.Name)
                    return asset;
            }

            return null;
        }
Exemple #6
0
        public static void DeleteAsset(IAssetService2 assetServiceClient, ItemId assetId)
        {
            ItemIdsRequest idsRequest = new ItemIdsRequest();
            idsRequest.ItemIds = new ItemIds();
            idsRequest.ItemIds.Add(assetId);

			assetServiceClient.RemoveAssets(idsRequest);
        }
Exemple #7
0
        public static void DeleteFolder(IAssetService2 assetServiceClient, Folder folder)
        {
            ItemIdsRequest request = new ItemIdsRequest();
            request.ItemIds = new ItemIds();
            request.ItemIds.Add(folder.ItemId);

			assetServiceClient.RemoveFolders(request);
        }