Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have got list item exception. [ArgumentException: Invalid Field Name.]

[ArgumentException: Invalid Field Name. {01b89bed-bbe3-4bcb-9b92-c64183ffe135}  /Lists/AcceptanceAgreements]
   Microsoft.SharePoint.SPFieldCollection.GetFieldById(Guid fieldId, Boolean bThrowException) +27057453
   Microsoft.SharePoint.SPRelatedFieldExtendedData.CalculateTitleAndUrl(SPList relatedList, Guid fieldId, Boolean includeFieldInformation) +119
   Microsoft.SharePoint.SPRelatedFieldExtendedData.GetRelatedFieldData(SPSite currentSite, SPWeb listWeb, SPRelatedField relatedField, Boolean includeFieldInformation) +733
   Microsoft.SharePoint.Utilities.SPUtility.BuildExtendedRelatedFieldsData(SPWeb web, List`1 extendedDataList, SPRelatedFieldCollection relatedFields, Boolean bNeverAppendFieldTitle) +678
   Microsoft.SharePoint.Utilities.SPUtility.GetCascadeDeleteWarningMessage(SPRelatedFieldCollection cascadeDeleteRelatedFields, SPWeb web) +130

In fact theres is a lookup from AcceptanceAgreements to AcceptancesProtocols (source list). But lookup ID field is [5eeb2b5e-484a-4a56-a397-55f21dc2dbf7] and not [01b89bed-bbe3-4bcb-9b92-c64183ffe135]. The field is not corrupted.

Is there any way to update ID of SPRelatedField? I have got already linked data in that lists.

I tried to use http://splookuplinker.codeplex.com/ but it doesn't work (after operation succeded message).

share|improve this question

1 Answer 1

I found solution for corrupted relations but please backup data before doing it!

exec proc_GetRelatedFieldsForList @SiteId='5795D2AB-D171-487A-A6B4-BD93A551773C',@ListId='F88CDA79-9412-46D9-8783-2D5738E8A4EA',@RequestGuid='00000000-0000-0000-0000-000000000000'

where listId is parent

/****** Object:  StoredProcedure [dbo].[proc_GetRelatedFieldsForList]    Script Date: 2013-03-20 10:01:38 ******/

ALTER PROCEDURE [dbo].[proc_GetRelatedFieldsForList](
    @SiteId uniqueidentifier,
    @ListId uniqueidentifier,
    @RequestGuid uniqueidentifier = NULL OUTPUT)    
AS
    SET NOCOUNT ON
    SELECT
        L.tp_WebId,
        L.tp_Id,
        ALR.FieldId,
        ALR.DeleteBehavior 
    FROM 
        TVF_AllLookupRelationships_SiteLookupList(@SiteId, @ListId) AS ALR
    CROSS APPLY
        TVF_Lists_Id(ALR.ListId) AS L



            CREATE FUNCTION [dbo].[TVF_AllLookupRelationships_SiteLookupList]
            (
                @SiteId uniqueidentifier,
                @LookupListId uniqueidentifier
            )
            RETURNS TABLE AS RETURN
                SELECT
                    *
                FROM
                    AllLookupRelationships WITH (INDEX=AllLookupRelationships_Backward)
                WHERE
                    SiteId = @SiteId AND
                    LookupListId = @LookupListId



CREATE FUNCTION [dbo].[TVF_AllLookupRelationships_SiteLookupList]
            (
                @SiteId uniqueidentifier,
                @LookupListId uniqueidentifier
            )
            RETURNS TABLE AS RETURN
                SELECT
                    *
                FROM
                    AllLookupRelationships WITH (INDEX=AllLookupRelationships_Backward)
                WHERE
                    SiteId = @SiteId AND
                    LookupListId = @LookupListId

Now open AllLookupRelationships table find rows by corrupted field ID and list ID, remove that row.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.