2010-12-10 20 views
0

私はSharePoint 2007のサイトを継承し、私は2010年の.DLLを使用して機能受信機を再コンパイルしていると私は、次のようなエラーに遭遇したのSharePoint 2010への移行に取り組んでいます:、Sharepointの2007年SharepointのpublishingWeb.currentNavigationNodesメソッドの置き換えは?

'Microsoft.SharePoint.Publishing.PublishingWeb' does not contain a definition for 'CurrentNavigationNodes' and no extension method 'CurrentNavigationNodes' accepting a first argument of type 'Microsoft.SharePoint.Publishing.PublishingWeb' could be found (are you missing a using directive or an assembly reference?)

CurrentNavigationNodesはMicrosoft.SharePoint.Publishing.PublishingWebのプロパティでした。どうやらそれは別のクラスに移ったか、まったく別の方法でノードリストを取得しています。私はそれを理解することはできません。誰もがこれを行う新しい方法は何か知っていますか?解決

 // set references to site, web, publishing site, publishing web 
     SPWeb thisWeb = (SPWeb)properties.Feature.Parent; 
     SPSite thisSite = thisWeb.Site; 
     PublishingSite thisPubSite = new PublishingSite(thisSite); 
     PublishingWeb thisPubWeb = PublishingWeb.GetPublishingWeb(thisWeb); 

     // enable tree view 
     thisWeb.TreeViewEnabled = true; 
     thisWeb.Update(); 


     // navigation settings 
     thisPubWeb.InheritGlobalNavigation = true; 
     thisPubWeb.InheritCurrentNavigation = false; 
     thisPubWeb.IncludePagesInNavigation = true; 
     thisPubWeb.IncludeSubSitesInNavigation = true; 
     thisPubWeb.NavigationShowSiblings = false; 


     // clear current navigation (thrice needed to get everything) 
     SPNavigationNodeCollection navNodes = thisPubWeb.CurrentNavigationNodes; 
     foreach (SPNavigationNode thisNavNode in navNodes) 
     { 
       navNodes.Delete(thisNavNode); 
     } 
     foreach (SPNavigationNode thisNavNode in navNodes) 
     { 
      navNodes.Delete(thisNavNode); 
     } 
     foreach (SPNavigationNode thisNavNode in navNodes) 
     { 
      navNodes.Delete(thisNavNode); 
     } 

     thisPubWeb.Update(); 

答えて

0

問題:

はここで2007のコードの関連する作品です。 PublishingWebがSPWebを拡張して以来、MicrosoftはPublishingWebからCurrentNavigationNodesを削除してSPWeb.Navigation.CurrentNavigationNodesを利用することになっているようです。

+0

あなたの答えは少し間違っています。 SP 2010にはSPWeb.Navigation.CurrentNavigationNodesはありませんが、SPWeb.Navigation:SPWeb.Navigation.QuickLaunchおよびSPWeb.Navigation.TopNavigationBarにこれらのプロパティがあります。 – marisks

関連する問題