0

I have bind some of the documents in grid view from Shared Document library programatically. And have kept link on the document. But when i click on the link it directly download the document. But I don't want the document to be downloaded, rather I want the behavior same as when we click on the document in Shared Document library. It opens the document in edit mode and also we can save the changes directly. How can I do this programatically.

Any help would be appreciated

Thanks.

1 Answer 1

2

You can try to use the OpenDocuments control which is shipped with SP.js

HTML example

<a href=""
    onclick="editDocumentWithProgID2('http://server/site/doclib/folder/Document.docx', 
    '', 
    'SharePoint.OpenDocuments', '0', 
    'http://server/site', '0')">
    This will open the file in edit mode
</a>

similar question: editDocumentWithProgID2 in CSOM

2
  • Thanks. But this is working in FireFox and IE. In Chrome I am facing an error like " we are sorry we couldn't find a program to open this document " . Can you help me for the same. Do i need any plugin or anything else??
    – DRS
    Commented Mar 21, 2016 at 5:35
  • I haven't implemented chrome support for this particular situation. you can conditionally provide a direct link to the document, which at least will open a local copy. other than that, I can't say, but it appears that chrome has become very restrictive so if you really want to support it, you'll have to get creative Commented Mar 21, 2016 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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