Kuv thiaj khiav mus rau qhov teeb meem no thiab hauv Google nkawd yeej tsis to taub dab tsi uas kuv xav ua, vim li ntawd kuv figured kuv yuav sau qhov no cia.
Kuv twb tau ua ntau ntawm cov kev tshwm sim receiver debugging nyob hauv lub limtiam ntawd lub xeem los yog ob tug. Tus ER txhais rau ib daim ntawv qiv. Nruj nreem cov khoom nyob rau hauv cov tsev qiv ntawv hauv daim ntawv ntawd txog rau cov niam txiv folders. Li ntawd, Kuv yog ib txwm nrhiav kev daim nplaub tshev ntawm yam khoom no rau ntau manipulations. Thaum debugging, Kuv yuav tsum tau hloov lub metadata ntawm tus ceev rau ib yam khoom uas nws daim ID kuv paub.
Nov yog tsab ntawv teev npe me ntsis console (tsim los khiav rau neeg rau zaub mov nyob hauv lub teb) uas yuav siv ob nqe lus: tus ID ntawm ib yam khoom muaj nqis mus cob rau ib lub teb, "Pom zoo raws li txoj cai". Tsis codes khoom ntau heev thiab yeej tsis yuam kev kuaj.
Tus tig mus rau ib qhov chaw ib coded, tau ib coded ib daim ntawv thiab pom qhov khoom ntawd ces. Nws mam li pom niam txiv sis yam ntawd khoom thiab assigns tus pej xeem Mes Kas tus nqi.
Qhov tseem ceeb Tshooj nov rau kuv yog tias SPItem tsis tau koj mus thov kom tus sis. Koj yuav tau siv cov SPListItem.File.
Yog hais tias tus neeg zov mus ce ib soj ntsuas ntaub ntawv los yog kom muab ib txoj kev zoo mus rau nplaub tshev los ntawm ib yam khoom, thov cia ib saib.
<chaws>
siv Tsim; siv System.Collections.Generic; siv System.Text; siv Microsoft.SharePoint; siv System.Collections; namespace Conchango { /// <txoj kev> /// </txoj kev> hoob ManualFolderUpdate { zoo li qub khoob lug Main(hlua[] args) { hlua msh = "ManualFolderUpdate (v1.0): "; // msh = "Message Header" Console.WriteLine(msh + "Pib. Kuv yog kawg hloov rau 08/04/08."); hlua url = http://localhost/xyzzy; siv (SPSite oSPSite = tshiab SPSite(url)) { siv (SPWeb oSPWeb = oSPSite.OpenWeb()) { Splist.Update() docLib = oSPWeb.Lists["Cov ntaub ntawv"]; Console.WriteLine(msh + "Tau txais lub tsev qiv ntawv hauv daim ntawv."); Console.WriteLine(msh + "Doc lib yam suav: [" + docLib.ItemCount + "]."); rau cov menyuam FolderID = 0; hlua NewStatus = "xyzzy"; FolderID = System.Hloov ua lwm yam.ToInt32(args[0].ToString()); Console.WriteLine("Nrhiav nplaub tshev rau khoom: [" + FolderID + "]."); SPListItem lis = docLib.GetItemById(FolderID); SPFolder thisItemFolder = lis.File.ParentFolder; Console.WriteLine(msh + "Tau txais tus niam/txiv sis."); NewStatus = args[1].ToString(); Console.WriteLine("Teev raws li txoj cai [" + NewStatus + "]."); Console.WriteLine("Nias rau nws kuas nyuas siv zug cov hloov tshiab lossis CTRL-C mus ho tuaj."); Console.ReadLine(); thisItemFolder.Item["Pom zoo rau lawv"] = NewStatus; thisItemFolder.Item.Update(); Console.WriteLine(msh + "Tas muab kho dua rau nplaub tshev. Teebmeem."); } // siv SPWeb } // siv SPSite Console.WriteLine(msh + "Tas."); } // Main } // hoob kawm foldersync } // namespace
</chaws>
</kawg>