Beware of deleting Global Navigation nodes in SPWeb.Navigation.GlobalNodes
For a standard team site (STS#0) the GlobalNodes SPNavigationNodesCollection will contain three SPNavigationNode objects.
Home, Quick Launch and SharePoint Top Navigation Bar, these each have Ids of 1000, 1002 and 1025 respectively.
The problem occurs if you delete Quick Launch or SharePoint Top Navigation nodes. Even if you then add them back in a new ID is generated and SPWeb.Navigation.TopNavigationBar looks for child nodes under a node with an Id of 1002 (This is hard coded).
Through the API this means that SPWeb.Navigation.TopNavigationBar will always be null and through the SharePoint UI an error will be returned to the user (“Value does not exist in that range”).
The only ways I have found to fix this is to delete and re-create the site or (Microsoft please close your ears) get the site id and web id and query the NavNodes table in the content database the site collection sits in and add the following records
SiteId |
WebId |
Eid |
EidParent |
NumChildren |
RankChild |
ElementType |
Url |
DocId |
Name |
DateLastModified |
NodeMetaInfo |
NonNavPage |
NavSequence |
ChildOfSequence |
C803FD13-27FA-475F-909C-2CE5B2048E1B |
A31E8093-1505-4E1C-B7CC-04D6B952A33F |
1000 |
0 |
0 |
0 |
0 |
NULL |
A31414EE-953B-44CC-A37E-4D5D643B002A |
Home |
2008-04-04 11:28:21.000 |
NULL |
False |
False |
False |
C803FD13-27FA-475F-909C-2CE5B2048E1B |
A31E8093-1505-4E1C-B7CC-04D6B952A33F |
1002 |
0 |
0 |
2 |
1 |
|
NULL |
SharePoint Top Navigation |
2008-04-04 11:28:21.000 |
NULL |
False |
True |
False |
C803FD13-27FA-475F-909C-2CE5B2048E1B |
A31E8093-1505-4E1C-B7CC-04D6B952A33F |
1025 |
0 |
0 |
1 |
1 |
|
NULL |
Quick Launch |
2008-04-04 11:28:21.000 |
NULL |
True |
True |
False |

I think top nav bar is 1002 and quick launch is 1025.
Hi, that is correct. The formatting of my blog theme seems to have cut half the table off that has the name column in it.
Is it by design that if you create a search site, you cannot use the top navigation either? Selecting “Display the same navigation items as the parent site” does not seem to work for these type of sites.
It worked for me!!! Thanks man! I just had to add one entry though:
INSERT INTO [PI_Content_BMA02].[dbo].[NavNodes]
( SiteId,
WebId,
Eid,
EidParent,
NumChildren,
RankChild,
ElementType,
Url,
DocId,
Name,
NameResource,
DateLastModified,
NodeMetainfo,
NonNavPage,
NavSequence,
ChildOfSequence
)
VALUES ( ’64DD26C0-77E6-4DB1-95A0-151B86D9F33A’,
’531127B5-C5BC-4C9A-958F-1B0E30D7FC95′,
1002,
0 ,–NumChildren
0,
1,
1,”,
NULL, –DocId
‘PKC SharePoint Top Navbar’ ,
‘PKC SharePoint Top Navbar’,
’2011-06-10 02:18:01.000′,
NULL ,
0,
1,
0
)
Here are the scripts that helped me to resolve the issue
INSERT INTO [NavNodes]
([SiteId], [WebId], [Eid], [EidParent], [NumChildren], [RankChild],[ElementType], [Url],
[DocId], [Name], [DateLastModified], [NodeMetainfo], [NonNavPage], [NavSequence], [ChildOfSequence])
SELECT DISTINCT SiteId, WebId ,1002 ,0 ,0 ,1 ,1 ,”, NULL, ‘SharePoint Top Navbar’,getdate() ,NULL ,0 ,1 ,0
FROM NavNodes WHERE WebId NOT IN (SELECT WebId FROM NavNodes WHERE Eid = 1002)
INSERT INTO [NavNodes]
([SiteId], [WebId], [Eid], [EidParent], [NumChildren], [RankChild],[ElementType], [Url],
[DocId], [Name], [DateLastModified], [NodeMetainfo], [NonNavPage], [NavSequence], [ChildOfSequence])
SELECT DISTINCT SiteId, WebId ,1025 ,0 ,0 ,0 ,1 ,”, Null, ‘Quick launch’,getdate() ,NULL ,1 ,1 ,0
FROM NavNodes WHERE WebId NOT IN (SELECT WebId FROM NavNodes WHERE Eid = 1025)
Excellent, cheers for that.