0

I am struggling the open documents on check out mode by using given path. I created a client on C# I solved authentication problems to accessing to sharepoint. But I don't know how to open documents on edit mode.

    // System.Diagnostics.Process.Start(docUrl); // using this opens documents on read only mode


    namespace Sp_Ctx{
      class Program {
        [STAThread]
    static void Main(string[] args){
        //if (args.Length < 1) { Console.WriteLine("SP_Ctx <url>"); return; }

        string targetSite = "https://x/y/z/";

        using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(targetSite))
        {
            if (ctx != null)
            {
                ctx.Load(ctx.Web); // Query for Web
                Microsoft.SharePoint.Client.Web web = ctx.Web;

                var folder = web.GetFolderByServerRelativeUrl(@"/a/b/c");

                ctx.ExecuteQuery(); // Execute
                Console.WriteLine(web.Title);
            }
        }
        Console.ReadLine(); }}}
  • This looks like a console app. What does opening a document in that context look like? – Derek Gusoff Jul 30 '17 at 2:50
  • Yes, it is a console app. If I use System.Diagnostics.Process.Start(docUrl); it opens the documents on read only mode. How can I open it for editing? – babacan Jul 31 '17 at 8:41
0

You might try adding an "open for edit" protocol handler to the url.

For example:

ms-word:ofe|u|http://example.com/myTestDocument.docx

Credit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.