SharePoint 中网络文件的 URL

发布于 2024-08-03 03:35:18 字数 166 浏览 2 评论 0原文

我在 SharePoint 列表中有一个列,我希望将其链接到网络上的文件。文件位置是在代码中生成的,因此我需要编写 CAML 脚本来更新该列。

有人可以给我一个例子,说明数据库中存储的值是什么吗?在此示例中,文件位置为 \server\folder\file.txt。如果可能的话,我希望文本名称相同。

I have a column in a SharePoint list that I wish to make a link to a file on the network. The file location is generated in code so I need to write a CAML script to update the column.

Could someone please give me an example of what the value stored in the database would be? In this example the file location is \server\folder\file.txt. I would like the textual name to be the same if possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老子叫无熙 2024-08-10 03:35:18

对于链接,您应该使用“超链接或图片”类型的列。此列类型可以处理链接及其描述。要为此字段设置这两个值,您可以使用以下代码。

SPFieldUrlValue urlField = new SPFieldUrlValue();
urlField.Description = @"\\server\folder\file.txt";
urlField.Url = @"\\server\folder\file.txt";

yourListItem["yourLinkColumnName"] = urlField;

yourListItem.Update();

SharePoint 会自动将链接从“\server\folder\file.txt”转换为“file://server/folder/file.txt”。但请注意,SharePoint 不会处理用户访问文件所需的权限。这只是一个链接。

For your link you should use a column of the type "Hyperlink or Picture". This column type can handle a link and a description for it. To set these both values for a this field you would use the following code.

SPFieldUrlValue urlField = new SPFieldUrlValue();
urlField.Description = @"\\server\folder\file.txt";
urlField.Url = @"\\server\folder\file.txt";

yourListItem["yourLinkColumnName"] = urlField;

yourListItem.Update();

SharePoint will automatically convert the link from "\server\folder\file.txt" to "file://server/folder/file.txt". But be aware that SharePoint won't handle the permissions a user needs to access the file. It's just a link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文