如何创建以文档库为目标并使用“名称”的查找列 文件的?
如何为文档库创建一个使用文档“名称”作为查找值的查找列?
我发现一篇博客文章建议添加另一个自定义字段,例如“FileName”,然后使用项目接收器使用“名称”字段中的值填充自定义字段,但这看起来很俗气。 如果人们感兴趣的话,链接到博客: http://blogs.msdn.com/pranab/archive/2008/01/08/sharepoint-2007-moss-wss-issue-with-lookup-column-to-doc- lib-name-field.aspx
我有一堆自定义文档内容类型,我不想让它们与无论如何应该真正起作用的解决方案混在一起。
How do you create a lookup column to a Document Library that uses the 'Name' of the document as the lookup value?
I found a blog post that recommends adding another custom field like "FileName" and then using a item reciever to populate the custom field with the value from the Name field but that seems cheesy.
Link to the blog in case people are interested:
http://blogs.msdn.com/pranab/archive/2008/01/08/sharepoint-2007-moss-wss-issue-with-lookup-column-to-doc-lib-name-field.aspx
I've got a bunch of custom document content types that I dont want to clutter with a work around that should really work anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我创建了一个一步工作流程来从名称设置标题,在修改时触发并创建。 似乎可以工作并且需要几秒钟才能创建。
I created a one step workflow to set the title from the name, fired on modify and created. Seems to work and took seconds to create.
实现此目的的一种方法(尽管不是最简单的方法)是创建扩展 SPFieldLookup 类的自定义字段类型。 SharePoint 的查找字段字段编辑器有目的地隐藏查找字段不支持的任何列类型,但您可以为自定义字段类型创建一个字段编辑器来显示它们。
但是,我之前创建了一个指向文档库中的名称列的查找列,它可能不会像您期望的那样工作。 虽然存储在查找列中的值有效,但它不会正确显示在列表视图或视图属性表单中。
您发布的解决方案实际上可能是处理此问题的最佳方法。 如果您想处理更复杂的场景,查找字段需要一些组装,但这是因为它们并不意味着提供与数据库中的外键关系相同的功能。
One way you can do this (although not the easiest way) is by creating a custom field type that extends the SPFieldLookup class. SharePoint's field editor for Lookup fields purposefully hides any columns types that aren't supported by Lookup fields, but you can create a field editor for your custom field type that shows them.
However, I have created a Lookup column that points to a Name column in a Document Library before, and it probably doesn't work like you'd expect. While the value stored in the lookup column is valid, it doesn't show up right in List view or on the View Properties form.
The solution you posted may actually be the best way to handle this. Lookup fields require some kludges if you want to handle more complex scenarios, but that's because they're not meant to provide the same functionality as a foreign key relationship in a database.
任何形式的编码总是让我感到害怕。 这就是我所做的:我只是将愚蠢的“标题”字段重命名为其他内容,例如“关键字”,因为您无法对该字段执行任何操作:甚至不能将其强制执行。
然后我创建了另一个名为“标题”的单行字段,并使用该字段进行查找
Coding in any form always scares me. So Here's what I did: I simply renamed the Stupid "Title" Field to something else, say "Keywords", since you cant do anything with that field: cant even make it mandatory.
Then I created another Single line field called "Title" and used this field for the Lookups
好吧,有一个简单的解决方案,并且在某些情况下可能有效。
简而言之,如果您将标题字段设为必填,这将强制用户输入标题。 通过这种方式,我们可以使用标题字段作为查找字段。
现在该怎么做呢?
创建文档库后,请转到库设置。 选择“高级设置”,然后为“允许管理内容类型?”选项选择“是”。
然后返回到库设置,并在内容类型下选择“文档”内容类型。 然后选择标题列,然后选择“必填(必须包含信息)”并说“确定”。
现在尝试将文档上传到此文档库。 您将在表单中看到标题字段。
希望这可以帮助
干杯
瓦卡尔
Well there is a simple solution to that and in might work in some case.
In the nutshell if you make the Title field Mandatory, this will force the user to enter a title. In that manner we can use title field as a lookup field.
Now How to do that?
One you are done create a document library go to the library setting. Select Advance Setting and Select Yes for the option "Allow management of content types?".
Then go back to the Library setting and Under content types select the "Document" Content type. THen Select Title Column and then Select "Required (Must contain information)" and say OK.
Now try uploading a document to this document library. You will see Title field in the form.
Hope this helps
Cheers
Vaqar
您必须将字段添加为 XML,其中 ShowField 为“FileLeafRef”
You have to add the field as XML with the ShowField as 'FileLeafRef'