SPFile.Properties Property
来源:互联网 发布:知乎 刘志军高铁贡献 编辑:程序博客网 时间:2024/06/03 05:15
C#VB
public Hashtable Properties { get; }
Property Value
Type: System.Collections.Hashtable
A System.Collections.Hashtable object that contains the metadata.
Remarks
The Windows SharePoint Services 3.0 object model supports updating file metadata. You can use an indexer on this property to set a value. For example, to set the value of the MyDate property for a given file to the current date and time, use the indexer and call the Update method, as follows:
[Visual Basic]
oFile("MyDate") = DateTime.Now
oFile.Update()
[C#]
oFile["MyDate"] = DateTime.Now;
oFile.Update();
Examples
The following code example iterates through the collection of files in a document library and displays the properties and values for each file.
This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint and Microsoft.SharePoint.Utilities namespaces.
C#VB
SPSite oSiteCollection = SPContext.Current.Site;
using(SPWeb oWebsite = oSiteCollection.AllWebs["Site_Name"])
{
SPFolder oFolder = oWebsite.Folders["Shared Documents"];
SPFileCollection collFiles = folder.Files;
foreach (SPFile oFile in collFiles)
{
System.Collections.Hashtable collHashes = file.Properties;
System.Collections.ICollection collKeys = hash.Keys;
foreach (object oKey in collKeys)
{
Response.Write(SPEncode.HtmlEncode(oKey.ToString())
+ " :: " +
SPEncode.HtmlEncode(hash[oKey.ToString()].ToString())
+ "<BR>");
}
}
}
The previous example displays metadata similar to the following:
vti_author :: User_Name
vti_cachedtitle :: New Page 1
vti_metatags :: HTTP-EQUIV=Content-Language en-us GENERATOR Microsoft\
FrontPage\ 5.0 ProgId FrontPage.Editor.Document
HTTP-EQUIV=Content-Type text/html;\ charset=windows-1252
vti_progid :: FrontPage.Editor.Document
vti_cachedbodystyle ::
vti_modifiedby :: User_Name
vti_charset :: windows-1252
vti_sourcecontrolcheckincomment :: Comment
vti_nexttolasttimemodified :: 5/6/2003 8:16:58 PM
vti_filesize :: 6439
vti_docstoretype :: 0
vti_language :: en-us
vti_generator :: Microsoft FrontPage 5.0
vti_timelastmodified :: 5/6/2003 8:59:25 PM
vti_title :: File_Title
vti_docstoreversion :: 2
vti_sourcecontrolcookie :: fp_internal
vti_sourcecontrolversion :: V2
vti_cachedneedsrewrite :: false
vti_timecreated :: 5/6/2003 8:16:58 PM
vti_cachedcustomprops :: vti_title
vti_cachedhastheme :: false
Note
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.
- SPFile.Properties Property
- Properties (@property )
- spfile
- spfile
- Spring properties context:property-placeholder
- EL Property Access and Nested Properties Examples
- Spring的properties解析【context:property-placeholder】
- context:property-placeholder和util:properties
- Properties/Property文件读取(键值均)乱码问题!
- spring:<context:property-placeholder location="classpath:application.properties" />
- spring:<context:property-placeholder location="classpath:application.properties" />
- spring配置文件中util:properties和context:property-placeholder
- spring:<context:property-placeholder location="classpath:application.properties" />
- 使用<context:property-placeholder>标签导入多个properties文件
- pfile+spfile
- spfile详解
- 生成spfile
- property
- 关于linux regulator dirver(1) fixed regulator:
- 中方对韩海警用橡皮弹致中国渔民死亡表示抗议-韩海警抓捕中国渔民-中韩渔业纠纷-非法捕捞
- 关于linux regulator dirver(2) OMAP PMIC regulator:
- Oracle RAC 10g on Linux(一)
- 最小生成树(Prim)
- SPFile.Properties Property
- xilinx与altera
- 基于ajax的Html5文件上传插件,带进度并支持图片预览
- iframe 自适应高度的问题(jquery控制)
- 如何删除cocos2d-x的模板
- 文章15:Nginx upload 模块(一)
- 我之于我
- Android SurfaceView简介
- Node.js零起点开发(二)-require的用法