Skip to main content

DELETE FILE WITH DM CODE

REQUIRED LIBRARIES
----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using Bimser.CSP.FormControls.Events;
using Bimser.CSP.Runtime.Common.Extensions;
using Bimser.Synergy.ServiceAPI.Models.Authentication;
using Bimser.Synergy.ServiceAPI;
using Newtonsoft.Json;
using Bimser.Synergy.Entities.Shared.Business.Objects;
using Bimser.Synergy.ServiceAPI.Models.Form;
using Bimser.Synergy.ServiceAPI.Models.Workflow;
using System.Threading.Tasks;
using Bimser.Synergy.Entities.DocumentManagement.Business.DTOs.Responses;
using Bimser.Framework.Web.Models;
using Bimser.Synergy.Entities.DocumentManagement.Business.DTOs.Requests;
using System.Linq;
using Bimser.Synergy.Entities.DocumentManagement.Business.Objects;
----------------------------------------------------------------------

METHOD REQUIRED TO RETRIEVE INFORMATION FOR AN OBJECT IN DOCUMENT MANAGEMENT
----------------------------------------------------------------------
public GetDMObjectResponse GetDMObjectInfo(string path)
{
WrapResponse```<```GetDMObjectsResponse```>``` dmObject = ServiceApi.DocumentManagement.GetDMObjectsFromPath(
new GetDMObjectsFromPathRequest(path)). Result;
GetDMObjectResponse dMObjectResponse = dmObject.Result.Items.First();
return dMObjectResponse;
}
----------------------------------------------------------------------

DELETION PROCESS
----------------------------------------------------------------------
DESCRIPTION: The secretkey is obtained by giving the path of the file to be deleted.
string fileSecretKey = GetDMObjectInfo("repo/folder1/Test1.txt"). SecretKey;

The received secretkey is given to the method that will do the work on the ServiceAPI side.
ServiceApi.DocumentManagement.DeleteFile(new DeleteFileRequest(fileSecretKey, "reason"));