对Document library中修改文档的Author之利用Feature添加新的Menu (初步方案)
2008-01-19 12:13
375 查看
背景:
老板有个需求,他说需要对document中的author进行修改。
分析:
1,sdk中显示该属性为只读的,无法修改。于是只好新建了另一个字段来做当Author。
2,怎么修改?添加menu在menu bar里面,然后再弹出一个新的窗口来修改。
3,具体的实现原理参照了people and group里面的一些方式, 用户先选中需要修改的item,然后通过点击menu实现。
实现:
本文先描述添加Menu的过程。
1, 在该目录下: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES新建DocumentEditAuthor的目录,首先新建Feature.xml(必须)。
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="619d2b43-47df-46ae-89e3-af5b43abbcc4"
Title="Edit Author Actions"
Description="A Feature with Update document author menu"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="MenuItem.xml" />
</ElementManifests>
</Feature>
2, 然后新建另一个文件MenuItem.xml(根据ElementManifest location的内容)。
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="MyCustomSelectedMenuAction"
RegistrationType="List"
RegistrationId="101"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1001"
Title="Update Selected ImageUrl="/_layouts/images/completeallwftasks.gif"
Description="Update selected document author.">
<UrlAction Url="javascript:GotoEditAuthor(0,' + {ListId} + ')"/>
</CustomAction>
<CustomAction Id="MyCustomAllMenuAction"
RegistrationType="List"
RegistrationId="101"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1002"
Title="Update All ImageUrl="/_layouts/images/menuEditItem.gif"
Description="Update all document author.">
<UrlAction Url="javascript:GotoEditAuthor(1,' + {ListId} + ')"/>
</CustomAction>
</Elements>
注意, 在UrlAction Url里面可以直接写某目录下的文件, 同时可以是javascript。
3, 发布该Feature.
stsadm.exe –o installfeature –name DocumentEditAuthor –force.
stsadm.exe –o activatefeature –name DocumentEditAuthor –url http://WebName/Docs/ -force.
4, IISRESET.
效果:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="A7A2885A-64B8-49F0-955B-7D976D6E293B"
Title="Extended List Actions"
Description="Expire Item"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Actions.xml" />
</ElementManifests>
</Feature>
2, Actions.xml的文件:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="CustomExpireItem"
Location="EditControlBlock"
Title="Expire Item "
ImageUrl="/_layouts/images/GORTL.GIF"
Sequence="300"
RegistrationType="ContentType"
RegistrationId="0x01">
<UrlAction Url="~site/_layouts/ExpireItemFolder/ExpireItem.aspx?List={ListId}&ID={ItemId}"/>
</CustomAction>
</Elements>
3, 发布该Feature:
stsadm.exe –o installfeature –name DocumentExpire –force.
stsadm.exe –o activatefeature –name DocumentExpire –url http://WebName/Docs/ -force
4, IISRESET
效果:
不同的menu,注意RegistrationType和RegistrationId。
关于Guid 可以通过 http://www.famkruithof.net/uuid/uuidgen很方便的生成。
关于Feature的详细内容,参考: http://msdn2.microsoft.com/en-us/library/ms473643.aspx。
老板有个需求,他说需要对document中的author进行修改。
分析:
1,sdk中显示该属性为只读的,无法修改。于是只好新建了另一个字段来做当Author。
2,怎么修改?添加menu在menu bar里面,然后再弹出一个新的窗口来修改。
3,具体的实现原理参照了people and group里面的一些方式, 用户先选中需要修改的item,然后通过点击menu实现。
实现:
本文先描述添加Menu的过程。
1, 在该目录下: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES新建DocumentEditAuthor的目录,首先新建Feature.xml(必须)。
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="619d2b43-47df-46ae-89e3-af5b43abbcc4"
Title="Edit Author Actions"
Description="A Feature with Update document author menu"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="MenuItem.xml" />
</ElementManifests>
</Feature>
2, 然后新建另一个文件MenuItem.xml(根据ElementManifest location的内容)。
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="MyCustomSelectedMenuAction"
RegistrationType="List"
RegistrationId="101"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1001"
Title="Update Selected ImageUrl="/_layouts/images/completeallwftasks.gif"
Description="Update selected document author.">
<UrlAction Url="javascript:GotoEditAuthor(0,' + {ListId} + ')"/>
</CustomAction>
<CustomAction Id="MyCustomAllMenuAction"
RegistrationType="List"
RegistrationId="101"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1002"
Title="Update All ImageUrl="/_layouts/images/menuEditItem.gif"
Description="Update all document author.">
<UrlAction Url="javascript:GotoEditAuthor(1,' + {ListId} + ')"/>
</CustomAction>
</Elements>
注意, 在UrlAction Url里面可以直接写某目录下的文件, 同时可以是javascript。
3, 发布该Feature.
stsadm.exe –o installfeature –name DocumentEditAuthor –force.
stsadm.exe –o activatefeature –name DocumentEditAuthor –url http://WebName/Docs/ -force.
4, IISRESET.
效果:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="A7A2885A-64B8-49F0-955B-7D976D6E293B"
Title="Extended List Actions"
Description="Expire Item"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Actions.xml" />
</ElementManifests>
</Feature>
2, Actions.xml的文件:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="CustomExpireItem"
Location="EditControlBlock"
Title="Expire Item "
ImageUrl="/_layouts/images/GORTL.GIF"
Sequence="300"
RegistrationType="ContentType"
RegistrationId="0x01">
<UrlAction Url="~site/_layouts/ExpireItemFolder/ExpireItem.aspx?List={ListId}&ID={ItemId}"/>
</CustomAction>
</Elements>
3, 发布该Feature:
stsadm.exe –o installfeature –name DocumentExpire –force.
stsadm.exe –o activatefeature –name DocumentExpire –url http://WebName/Docs/ -force
4, IISRESET
效果:
不同的menu,注意RegistrationType和RegistrationId。
关于Guid 可以通过 http://www.famkruithof.net/uuid/uuidgen很方便的生成。
关于Feature的详细内容,参考: http://msdn2.microsoft.com/en-us/library/ms473643.aspx。
相关文章推荐
- 对Document library中修改文档的Author之利用Feature添加新的Menu (一)
- 对Document library中修改文档的Author之添加checbox在list(初步方案)
- 对Document library中修改文档的Author之实现修改在list(初步方案)
- 对Document library中修改文档的Author之添加checbox在list(二)
- 对Document library中修改文档的Author之实现修改在list(三)
- 对Document library中修改文档的Author(改进)
- 可视化webpart基础开发——利用事件接收器实现同步操作两个文档库(添加、删除、修改文档)
- 可视化webpart基础开发——利用事件接收器实现同步操作两个文档库(添加、删除、修改文档)
- Add a file to a Document Library and update metadata properties in a single method添加文档的方法
- 可视化webpart基础开发——利用事件接收器实现同步操作两个文档库(添加、删除、修改文档)
- iOS利用UIDocumentInteractionController和Quick Look打开或预览文档
- 利用vbs脚本快速修改hosts记录,提供Google Picasa相册无法显示图片问题的傻瓜级方案(2009.11.11更新) 推荐
- 如何利用BAPI SD_SALESDOCUMENT_CHANGE修改Sales Order的字段
- 为Eclipse/MyEclipse添加JDK API Document帮助文档
- RevitAPI:不要在遍历(Iterate)过滤出来的收集器(FilteredElementCollector)时修改文档(Document)
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中。添加 :删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)
- lucene 对索引的文档进行添加 修改 删除
- 基本查询语句及利用SQL语句完成数据的添加、删除、修改操作
- 之利用UIDocumentInteractionController打开和预览文档
- VS2010利用宏快速添加注释(函数描述,修改注释等)