惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
博客园_首页
N
News | PayPal Newsroom
有赞技术团队
有赞技术团队
The Hacker News
The Hacker News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
S
SegmentFault 最新的问题
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
P
Privacy & Cybersecurity Law Blog
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Schneier on Security
Schneier on Security
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
量子位
Forbes - Security
Forbes - Security
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tor Project blog
Recorded Future
Recorded Future
A
About on SuperTechFans
J
Java Code Geeks
The Register - Security
The Register - Security
PCI Perspectives
PCI Perspectives
H
Hacker News: Front Page
V2EX - 技术
V2EX - 技术
S
Secure Thoughts
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Scott Helme
Scott Helme
T
The Exploit Database - CXSecurity.com
Y
Y Combinator Blog
AWS News Blog
AWS News Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
F
Full Disclosure
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The GitHub Blog
The GitHub Blog

博客园 - 范文轩

Sharepoint中的Feature Stapling功能 SharePoint 2010中的WebProvisioned Event Handler 如何向列表中添加数据值(开发篇补充REST) 如何向列表中添加数据值(开发篇) 在SharePoint 2010中动态加载Visio Web Part 使用编程的方式来启动SharePoint的工作流 InfoPath 2010调用REST的一个小应用 SharePoint 2010 WSP包部署过程中究竟发生什么? 如何查看SharePoint 2010的CU版本 SharePoint 2010多语言包的安装 在SharePoint 2010中使用Linq时候,请注意特殊字符 自定义ASP.NET WebApplication中调用SharePoint2010的对象 在Infopath 2010中调用Web Service 谈谈SharePoint 2010的客户端对象模型的性能问题 给Document Set里面添加文件夹 给Chart Web Part 添加过滤功能 SharePoint 2010的Form认证的用户注册功能 SharePoint 调查列表的自定义错误页面 Reporting Services 2008 and SharePoint 2010
如何向列表中添加数据值(管理员篇)
范文轩 · 2011-08-13 · via 博客园 - 范文轩

如何向列表中插入数据?这是一个很简单的问题。那么我的这两篇文章主要是对各种方法的总结,如果有朋友有不同的意见,请指正。

首先,我们来看一下列表(自定义列表,列表名称:Jobs).

列名 类型 注释
Title 单行文本  
JobDescription 多行文本  
City 选择项  
DueDate 日期  
JobRequirement Lookup类型 指向另一个列表:Skills
Manager 人员  

管理员添加数据的方法我总结为三种。通过界面添加;使用Workspace 2010添加; 使用Powershell命令添加。以下是依次的详细内容或者截图:

1. 界面添加:

blog-SPDataOperation-02

2. 使用workspace 2010添加。(前提:你需要安装SharePoint Workspace 2010)和界面操作的效果类似。

blog-SPDataOperation-03

3.使用powershell调用.Net assembly的方式来添加。(对于其中的Lookup 列,我是直接指定Lookup ID)

[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
$site=[Microsoft.SharePoint.SPSite]("http://servername")
$web=$site.OpenWeb()
$list=$web.Lists["Jobs"]
$newitem=$list.items.Add()
$newitem["Title"]="UI Developer"
$newitem["JobDescription"]="This is a <b>FTE</b> Job"
$newitem["City"]= "Shanghai"
$newitem["DueDate"]= [DateTime]::Now.AddDays(10)
$newitem["JobRequirement"]= 3
$newitem["Manager"]= $web.EnsureUser("domain\alias").ID
$newitem.update()
$web.Dispose()
$site.Dispose() 

下一篇中,我将尝试调用对象模型的方式来向列表添加元素。