проблема разбить один проект SharePoint на куски - PullRequest
1 голос
/ 07 июля 2010

Я пытаюсь разбить свой проект sharepoint на несколько небольших проектов. Я мог бы легко перемещать служебные файлы в другой проект. Однако я столкнулся с проблемой при перемещении пользовательских полей.

Если я переместу настраиваемое поле из ProjectA в ProjectB и настрою ProjectA для ссылки на DLL-файл ProjectB, сборка и развертывание будут работать нормально. Однако при обращении к пользовательскому полю ссылки на программу из SPListItem она вызывает исключение System.ArgumentOutOfRangeException.

, например

SPListItem item = splist.GetItemById(id);<br>
CustomFieldValue custom = item["Custom"] // Error occurs here

Кроме того, если я вызываю AddFieldAsXml для определения указанного выше пользовательского поля, я получаю ту же ошибку.

Может кто-нибудь помочь мне решить эту проблему? заранее спасибо ...

Деталь ошибки произошла в AddFieldAsXml (такая же ошибка возникает при ссылке)

Length cannot be less than zero.
Parameter name: length 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7494967
   System.String.Substring(Int32 startIndex, Int32 length) +11
   Microsoft.SharePoint.Publishing.PublishingHttpModule.CreateSPField(String fieldTypeName, SPFieldCollection collection, String fieldName) +80
   Microsoft.SharePoint.SPFieldCollection.CreateSPField(Int32 index) +2746
   Microsoft.SharePoint.SPFieldCollection.EnsureSPField(Int32 index) +89
   Microsoft.SharePoint.SPFieldCollection.get_Item(Int32 iIndex) +113
   Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException) +180
   Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName) +38
   Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op) +905
   Microsoft.SharePoint.SPFieldCollection.AddFieldAsXml(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op) +45

Эта ошибка отображается, если значение длины string.substring (int startIndex, int length) равно минус ... но я не знаю, почему я получаю эту ошибку.

1 Ответ

1 голос
/ 09 июля 2010

Я решил проблему ... Я не копировал информацию fldtypes_xxxx.xml. поэтому, когда код пытается прочитать некоторую информацию из xml, возникает исключение ...

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...