Prerequisites
If you have configured the RMS permission document in moss2010 and use the Office web app to view the document online, the following error will be prompted:
In the face of such problems, Microsoft does not go out of the patch package to solve them. Therefore, we can only find other solutions. Here we use the weboffice plug-in for online preview.
Note: The principle of weboffice plug-in is to embed the client office into the browser. Therefore, the client to be accessed installs the Office and supports Internet Explorer access, which is not supported by other browsers.
Custom configuration weboffice Development
1. Use vs2012 to create a sharepoint2010 solution. [Create an application.ProgramPage:
2. Reference The weboffice plug-in package, for example:
3. Edit the application page, for example:
Page source code: Background Code : Using System; Using Microsoft. SharePoint; Using Microsoft. Sharepoint. webcontrols; Namespace Mosswebofficemenu. layouts. mosswebofficemenu { Public Partial Class Testweboffice: layoutspagebase { Public String Fileurl = String . Empty; Public String Extname = String . Empty; // Protected Void Page_load ( Object Sender, eventargs e ){ String Itemid = request. querystring [ "Itemid" ] = Null ? String . Empty: request. querystring [ "Itemid" ]. Tostring (); If (! String . Isnullorempty (Itemid )){ // Spweb web = spcontext. Current. Web; // If (Web! = Null ) {Splist list = web. Lists [ "Test document" ];If (List! = Null ) {Splistitem item = List. getitembyid (convert. toint32 (Itemid )); // If (Item! = Null ) {Spfile file = item. file; // If (File! = Null ) {Fileurl = String . Format ( "{0}/{1 }" , Web. url, file. url );// A file is required. If (! String . Isnullorempty (fileurl )){ If (Fileurl. lastindexof ( '.' )> = 0) {extname = fileurl. substring (fileurl. lastindexof ( '.' ) + 1 );}}}}}}}}}}
4. Publish It To The moss2010 website.
Configuration drop-down menu
1. Create a document library [shared document]. This process is omitted (not in zookeeper, haha ).
2. Open the shared document list in the document library, for example:
3. Edit the page, for example:
4. Add the "Content Editor" webpart and open the "Media and content-" Content Editor, for example:
5. Insert a webpart, such:
6. Click "Click here to add new content" in the middle, as shown in:
7. Click "html" on the toolbar to edit the HTML source code, for example:
8. A dialog box is displayed, such:
9,
Copy the following Javascript script to the HTML source. Javascript script: <script language = "JavaScript" > // C and A take their own names Function custom_adddoclibmenuitems (C, ){ // Drop-down menu name Strdisplaytext = "Open a document online with weboffice" ; // The script to be executed, which can be customized // A. httproot current web site address // Currentitemid the current Itemid // A. listname current list name // Stsnavigate is a moss jump execution function. Straction ="Stsnavigate ('" + A. httproot + "/_ Layouts/mosswebofficemenu/testweboffice. aspx? Itemid =" + Currentitemid + "& Listid =" + A. listname + "')" ; // The image displayed in the drop-down menu Strimagepath = A. imagespath + "Oisweb.gif" ; // Execute the script Menuoption = camopt (C, strdisplaytext, straction, strimagepath, Null , 260 ); // Menu ID Menuoption. ID = "Id_mysubmenu" ; // Return Return False ;}</SCRIPT>
10. Click "OK" to stop editing on the page, for example:
11. After the editing page is stopped, the final result is as follows:
12. Click "Open Document online with weboffice" to go to the page created by javascript ::
Note:
Udfs addlistmenuitems (list Library) and adddoclibmenuitems (Document Library)