Open Document directly in Edit Mode within SharePoint from an Email link
If you send a link to a SharePoint document with Email to another user, the document is opened in read only mode. It is not possible to open it directly in Edit Mode.
Therefore I wrote a little JavaScript which can do that easily.
Steps to implement:
1.) Create a new page on the sitecollection you want to have this ability. Name it OpenDoc.
2.) Add the "XML-Viewer" WebPart from "Content Rollup" category.
3.) Open the WebPart Settings of the XML-Viewer WebPart
4.) Click on XML-Editor Button and add following JavaScript into it:
5.) Adapt the baseUrl variable to your sitecollection
That's it.
When you want to open a file directly in edit mode copy the link of the file :
To open the file in edit mode you have to create the link manually. DocumentUrl is the copied file url.
like
Therefore I wrote a little JavaScript which can do that easily.
Steps to implement:
1.) Create a new page on the sitecollection you want to have this ability. Name it OpenDoc.
2.) Add the "XML-Viewer" WebPart from "Content Rollup" category.
3.) Open the WebPart Settings of the XML-Viewer WebPart
4.) Click on XML-Editor Button and add following JavaScript into it:
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(LoadDoc, "sp.js");
function LoadDoc() {
JSRequest.EnsureSetup();
var file = JSRequest.QueryString["file"];
if (typeof file != "undefined" && file != "") {
var baseUrl= "http://sharepoint/sites/mysite";
var host = location.protocol + "//" + location.host;
var docUrl = file.replace(host, "");
var i = file.lastIndexOf("/");
var listUrl = file.substr(0, i);
editDocumentWithProgID2(docUrl, '', 'SharePoint.OpenDocuments', '0', baseUrl, '0')
location.href = listUrl;
}
}
</script>
5.) Adapt the baseUrl variable to your sitecollection
That's it.
When you want to open a file directly in edit mode copy the link of the file :
To open the file in edit mode you have to create the link manually. DocumentUrl is the copied file url.
- PageUrl + ? + file= + DocumentUrl
like
- http://sharepoint/sites/mysite/sitepages/opendoc.aspx?file=http://sharepoint/sites/mysite/docs/lavazza.xls
Comments