SharePoint-无效的字段名称错误 [英] SharePoint - Invalid Field Name Error

查看:116
本文介绍了SharePoint-无效的字段名称错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新

值得一提的是,这仅在从SPWebApplication.Sites.Add调用网站定义时发生,如果我使用UI,则可以正常工作.我的代码在调用该代码时模拟了系统帐户.

Worth noting that this is only happening when the site definition is called from SPWebApplication.Sites.Add, if I use the UI then this works fine. My code is impersonating the system account when calling this code.

我是否认为SPSite的ApplyWebTemplate()方法是异步的?如果是这种情况,那么我的问题可能是时机之一. IE.运行此代码时,所需的基础结构尚未就绪.

Am I right in thinking that the ApplyWebTemplate() method of SPSite is asynchronous? If this is the case then my issue is probably one of timing. I.e. the required infrastructure is not yet in place when this code is run.

原始问题

我有一个自定义网站定义,该定义使用SPProvisioningProvider配置网站集.

I have a custom site definition which is using an SPProvisioningProvider to configure the site collection.

在调用ApplyWebTemplate("BLANKINTERNET#0")以应用标准发布门户网站定义之后,我试图基于具有TOC页面布局的欢迎页面创建新页面.

After calling ApplyWebTemplate("BLANKINTERNET#0") to apply the standard publishing portal site defintion, I am trying to create a new page based on the welcome page with TOC page layout.

但是我在调​​用这段代码时却遇到了异常

However I am getting an exception when I call this piece of code

Dim pubSite As New PublishingSite(_siteColl)
Dim pubWeb As PublishingWeb = PublishingWeb.GetPublishingWeb(site)

Dim layouts() As PageLayout = Nothing
layouts = pubWeb.GetAvailablePageLayouts(_welcomeContentTypeID)

在GetAvailablePageLayouts方法调用中引发以下异常.

The following exception is raised at the GetAvailablePageLayouts method call.

无效的字段名称. {7581e709-5d87-42e7-9fe6-698ef5e86dd3}

Invalid field name. {7581e709-5d87-42e7-9fe6-698ef5e86dd3}

这仅在我们的直播农场中发生.它没有在开发人员或测试环境中发生,因此我希望这是配置更改,但是我在Tinterweb上可以找到的所有引用(原文如此)都与缺少字段类型"PublishingHidden"有关,但是我该如何恢复呢?鉴于这是在网站集供应过程中发生的?

This is only happening on our live farm. It did not happen on dev or in the test environment so I am hoping it is a configuration change, but all references I can find on Tinterweb (sic) are related to the Field Type 'PublishingHidden' being missing, but how can I restore this given that this is happening in the site collection provisioning process?

谢谢

查理

推荐答案

您可能要检查代码,并确保未按其显示名称访问该字段...

You might want to check your code and make sure you are not accessing the field by its display name...

fieldName = web.lists [mylist] .Fields ["FieldName"].InternalName

fieldName = web.lists[mylist].Fields["FieldName"].InternalName

这篇关于SharePoint-无效的字段名称错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆