How to check out a file using SourceAnywhere Hosted COM SDK?

In this article, we take a C# Project as example.

1.  Install SourceAnywhere Hosted COM SDK on your machine.

2.  Add “SAWHSDK.dll” to the project. In Visual Studio, click menu Project | Add Reference | Browse, browse to the installation folder of SourceAnywhere Hosted COM SDK, select “SAWHSDK.dll” and click OK.

3.  You can use ConnectToServer() to connect to SourceAnywhere Hosted Server and use Login() to log into your account and then use CheckoutFiles() to check out a file.

Here is a sample in C#:

private void btnConnect_Click(object sender, EventArgs e)



           long ResultValue;

           Enum_EncryptType EncryptType;

            SAWHGlobalMessageSet GlobalMessageSet;

            string PlanName;

            bool Cancelled;

            string ResultDescription;


           ResultValue = SAWH.ConnectToServer(181915, false, false, "", 0, Enum_ProxyType.Enum_NOPROXY, "", 0, "", "", out EncryptType,out GlobalMessageSet,out PlanName,out Cancelled,out ResultDescription);

           if (ResultValue == 0)


               bool MustChangePassword;

               int DaysOfExpiration;

               bool Cancelled1;

               string ResultDescription1;


               SAWH.Login("dynamsoft", "sawh", "default", out MustChangePassword, out DaysOfExpiration, out Cancelled1, out ResultDescription1);






        private void btnCheckOut_Click(object sender, EventArgs e)


            long ResultValue;           

            SAWHDiffMergeParam MergeParam = new SAWHDiffMergeParam();

            bool Cancelled;

            String ResultDescription;

            SAWHOperationResultSet OperationResultSet;

            SAWHCheckoutFileSet CheckoutFileSet = new SAWHCheckoutFileSet();

            SAWHCheckoutFile CheckoutFile = new SAWHCheckoutFile();


            CheckoutFile.FileToCheckout = "$/posts.doc";

            CheckoutFile.LocalFileName = "D:\\temp\\posts.doc";



            ResultValue = SAWH.CheckoutFiles(CheckoutFileSet, false, "", false, Enum_ModifiedFileHandling.Enum_AskModifiedFile, Enum_EOL.Enum_EOLWindowsCRLF, Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_SetLocalFileTime.Enum_SetLocalFileTimeModification, MergeParam, out Cancelled, out ResultDescription, out OperationResultSet);