Only allow to save documents and not to open
Hi,
because we have some known Office - SharePoint Integration problems while using client certificates for external users, we decided to turn off the option to open any document directly out of sharepoint (word, excel, pp,...). The user should only be
able to download documents on his local pc and upload them back to sharepoint manually. Is there any solution for that? I've found nothing similar.
I am thankful for any help.
June 16th, 2011 10:52am
The ability to open documents directly out of SharePoint is made possible using a special managed code assembly. This is specified for each extension in the DOCICON.XML file. If you modify the entries to remove the OpenControl= attribute from
the entries in the DocIcon.xml file then users will only be able to download files and not open them directly from SharePoint. They will still be able to Save files back to SharePoint directly. The following article explains how to add a mapping
to the DOCICON.XML file. You want to do the opposite.
http://msdn.microsoft.com/en-us/library/aa978104.aspxPaul Stork SharePoint Server MVP
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2011 11:14am
Hi Paul,
first, thank you very much for your fast answer.
I've tried this out but with no luck. I've still the option to open (docx) files and and save the changes back to sharepoint out of Word 2010.
Indeed the document is read-only but I think in this case the user will give it another name and saves it to SharePoint. The consequence is that
versioning will not work.
The behavior for files like .pdf is what I need for Office-Files... docx, xlsx, ...
Perhaps I did something wrong so here are the changes I made in the DOCICON.XML file:
(ByProgID)
<Mapping Key="Word.Document" Value="ichtmdoc.gif" OpenControl=""/>
(ByExtension)
<Mapping Key="doc" Value="icdoc.png" OpenControl=""/>
<Mapping Key="docm" Value="icdocm.png" OpenControl=""/>
<Mapping Key="docx" Value="icdocx.png" OpenControl=""/>
<Mapping Key="dot" Value="icdot.png" OpenControl=""/>
<Mapping Key="dotm" Value="icdotm.png" OpenControl=""/>
<Mapping Key="dotx" Value="icdotx.png" OpenControl=""/>
June 17th, 2011 10:02am
Nope, sounds like you did everything correctly. That's why the documents are opening Read Only. The only way to lock it down more tightly than that is to implement Rights Management Services.
http://msdn.microsoft.com/en-us/library/ms458245.aspxPaul Stork SharePoint Server MVP
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2011 2:09pm
My solution was a mix of customizing the DOCICON.xml, the Central Administration and an Event Receiver
1. In the Central Administration --> Manage Web Applications --> Choose the Web Appl. --> General Settings --> Browser File Handling --> Strict
2. Make the changes in the DOCICON.xml like Paul stork suggested
3. Create a Document Library template with a hyperlink column
4. Write an Event Receiver that fills the hyperlink column with a link that has the same behavior as the "Download a copy" button
Here is my code... (My programming skills are not so good, but it works for me... perhaps somebody has ideas for improvements)
public override
void ItemAdded(SPItemEventProperties properties)
{
this.EventFiringEnabled =
false;
SPListItem li = properties.ListItem;
SPFieldUrlValue spli =
new SPFieldUrlValue();
string twotimesencode =
SPHttpUtility.UrlKeyValueEncode(properties.WebUrl +
"/" + properties.ListTitle + "/Forms/AllItems.aspx");
spli.Url = properties.WebUrl + "/" +
"_layouts/download.aspx?SourceUrl=" + SPHttpUtility.UrlKeyValueEncode(properties.RelativeWebUrl +"/"+properties.ListItem.Url ) +
"&FldUrl=&Source=" +
SPHttpUtility.UrlKeyValueEncode(twotimesencode);
spli.Description = li["Name"].ToString();
li["Dokumentname"] = spli;
li.Update();
base.ItemAdded(properties);
this.EventFiringEnabled =
true;
}
//Make sure that you have set the Synchronization Element to "Synchronous" in the Elements.xml to avoid save conflicts
// <Synchronization>Synchronous</Synchronization>
June 22nd, 2011 4:30pm