[{"data":1,"prerenderedAt":949},["ShallowReactive",2],{"tag-sharepoint":3},{"tag":4,"articles":24},{"id":5,"title":6,"body":7,"description":14,"extension":15,"img":16,"meta":17,"name":18,"navigation":19,"path":20,"seo":21,"stem":22,"__hash__":23},"tags\u002Ftags\u002Fsharepoint.md","Sharepoint",{"type":8,"value":9,"toc":10},"minimark",[],{"title":11,"searchDepth":12,"depth":12,"links":13},"",2,[],"Microsoft SharePoint","md","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"sharepoint",true,"\u002Ftags\u002Fsharepoint",{"description":14},"tags\u002Fsharepoint","1yMA-SLjOHmy0x6_m2U0v9b58OVV2Jg1i0vhgXavZ7M",[25,239,317,490,518,547,570,603,768,925],{"id":26,"title":27,"author":28,"body":29,"createdAt":230,"description":231,"extension":15,"img":232,"meta":233,"navigation":19,"path":234,"seo":235,"stem":236,"tags":237,"updatedAt":230,"__hash__":238},"articles\u002Farticles\u002Ffeature-exists-activated-on-spsite.md","Feature Exists (Activated on SPSite)","[object Object]",{"type":8,"value":30,"toc":228},[31,35,225],[32,33,34],"p",{},"Method to iterate through SharePoint SPSite collection to check to\nsee if a feature (featureGuid) exists.  If found, method returns true.",[36,37,40,53,61,66,73,78,86,91,98,105,112,117,124,131,138,143,150,155,162,169,176,186,193,199,206,213,220],"pre",{"className":38},[39],"csharpcode",[41,42,44,51],"span",{"style":43},"font-family: Consolas; font-size: x-small;",[41,45,46],{"style":43},[41,47,48],{"style":43},[41,49,50],{"style":43}," ",[41,52,50],{"style":43},[41,54,56],{"style":55},"font-family: Consolas; color: #0000ff; font-size: x-small;",[41,57,58],{"style":55},[41,59,60],{"style":55}," private",[41,62,63],{"style":43},[41,64,65],{"style":43}," ",[41,67,68],{"style":55},[41,69,70],{"style":55},[41,71,72],{"style":55},"bool",[41,74,75],{"style":43},[41,76,77],{"style":43}," FeatureExists(",[41,79,81],{"style":80},"font-family: Consolas; color: #2b91af; font-size: x-small;",[41,82,83],{"style":80},[41,84,85],{"style":80},"SPSite",[41,87,88],{"style":43},[41,89,90],{"style":43}," siteCollection, ",[41,92,93],{"style":80},[41,94,95],{"style":80},[41,96,97],{"style":80},"Guid",[41,99,100,103],{"style":43},[41,101,102],{"style":43}," featureGuid) {",[41,104,50],{"style":43},[41,106,107],{"style":55},[41,108,109],{"style":55},[41,110,111],{"style":55},"    bool",[41,113,114],{"style":43},[41,115,116],{"style":43}," found = ",[41,118,119],{"style":55},[41,120,121],{"style":55},[41,122,123],{"style":55},"false",[41,125,126,129],{"style":43},[41,127,128],{"style":43},";",[41,130,50],{"style":43},[41,132,133],{"style":55},[41,134,135],{"style":55},[41,136,137],{"style":55},"    foreach",[41,139,140],{"style":43},[41,141,142],{"style":43}," (",[41,144,145],{"style":80},[41,146,147],{"style":80},[41,148,149],{"style":80},"SPFeature",[41,151,152],{"style":43},[41,153,154],{"style":43}," feature ",[41,156,157],{"style":55},[41,158,159],{"style":55},[41,160,161],{"style":55},"in",[41,163,164,167],{"style":43},[41,165,166],{"style":43}," siteCollection.Features) {",[41,168,50],{"style":43},[41,170,171],{"style":55},[41,172,173],{"style":55},[41,174,175],{"style":55},"    if",[41,177,178],{"style":43},[41,179,180,181],{"style":43}," (feature.DefinitionId == featureGuid) {\n",[41,182,183],{"style":43},[41,184,185],{"style":43},"      found = ",[41,187,188],{"style":55},[41,189,190],{"style":55},[41,191,192],{"style":55},"true",[41,194,195,197],{"style":43},[41,196,128],{"style":43},[41,198,50],{"style":43},[41,200,201],{"style":55},[41,202,203],{"style":55},[41,204,205],{"style":55},"      break",[41,207,208,211],{"style":43},[41,209,210],{"style":43},";    }  }",[41,212,50],{"style":43},[41,214,215],{"style":55},[41,216,217],{"style":55},[41,218,219],{"style":55}," return",[41,221,222],{"style":43},[41,223,224],{"style":43}," found;} ",[32,226,227],{},"Cool eh?",{"title":11,"searchDepth":12,"depth":12,"links":229},[],"2017-05-29T20:59:15.5333517Z","Iterate through SharePoint SPSite collection",null,{},"\u002Farticles\u002Ffeature-exists-activated-on-spsite",{"title":27,"description":231},"articles\u002Ffeature-exists-activated-on-spsite",[18],"HNB5xxrT3JuSE5aSwOI_YI0ghRpedBgb1Wc6au43Yp4",{"id":240,"title":241,"author":28,"body":242,"createdAt":309,"description":310,"extension":15,"img":232,"meta":311,"navigation":19,"path":312,"seo":313,"stem":314,"tags":315,"updatedAt":309,"__hash__":316},"articles\u002Farticles\u002Fsharepoint-web-part-deployment.md","Sharepoint Web Part Deployment",{"type":8,"value":243,"toc":307},[244,247,283,286],[32,245,246],{},"If when using Windows Sharepoint Services you are unable to retract or execute jobs seen through the management interface using the following commands can help to manually list and remove and redeploy solutions.",[32,248,249,250,253,257,258,260,263,264,266,269,270,272,277,279,282],{},"To see a list of all solutions on the server",[251,252],"br",{},[254,255,256],"strong",{},"stsadm.exe -o enumsolutions","  To see a list of all deployments",[251,259],{},[254,261,262],{},"stsadm.exe -o enumdployments","  To cancel a deployment",[251,265],{},[254,267,268],{},"stsadm.exe -o canceldeployment -id {guid}","  To execute scheduled jobs",[251,271],{},[254,273,274,275],{},"stsadm.exe -o execadmsvcjobs",[251,276],{},[251,278],{},[254,280,281],{},"Error: \"the solution cannot be removed when a job is scheduled or is running\" \u003C ","use the above commands to execute jobs that are scheduled",[32,284,285],{},"I am using something like the following when removing and deploying web parts (notice the execadmsvcjobs)",[32,287,288,289,295,296,298,299,301,302,304,305,295],{},"stsadm.exe -o retractsolution -name webPart.wsp -immediate -url {",[290,291,294],"a",{"rel":292},[293],"nofollow","http:\u002F\u002F...} ","\nstsadm.exe -o execadmsvcjobs",[251,297],{},"\nstsadm.exe -o deletesolution -name webPart.wsp -override",[251,300],{},"\nstsadm.exe -o addsolution -filename webPart.wsp",[251,303],{},"\nstsadm.exe -o deploysolution -name webPart.wsp -immediate -allowgacdeployment -url {http:\u002F\u002F...} -force",[251,306],{},{"title":11,"searchDepth":12,"depth":12,"links":308},[],"2015-04-20T08:07:18.3200000-04:00","Learn how to deploy web parts.",{},"\u002Farticles\u002Fsharepoint-web-part-deployment",{"title":241,"description":310},"articles\u002Fsharepoint-web-part-deployment",[18],"o0IIXKtNlmzSimnQm8juIvIaJ1WCP7U-9Nnxq9lvtrA",{"id":318,"title":319,"author":28,"body":320,"createdAt":483,"description":232,"extension":15,"img":232,"meta":484,"navigation":19,"path":485,"seo":486,"stem":487,"tags":488,"updatedAt":483,"__hash__":489},"articles\u002Farticles\u002Fsharepoint-wss-3-0-tips-debugging.md","Sharepoint WSS 3 Tips Debugging",{"type":8,"value":321,"toc":481},[322,325,336,339,346,349,352,385,463,474,477],[32,323,324],{},"Getting the w3wp.exe ProcessID for Attach to Process  ",[326,327,328,329,332,333,65],"blockquote",{},"   ",[254,330,331],{},"Open command prompt and type iisapp.vbs","     ",[254,334,335],{},"Attach a debugger to your code",[254,337,338],{},"The code you are using to debug must be exactly the same as the executing assembly",[32,340,341,342,345],{},"This often catches people out in SharePoint development as the assembly SharePoint is using is often in a different location than the default build directory (i.e. in the bin directory in IIS or in the GAC). You may want to include a post build script to copy your assembly to the correct location to help automate this process. Also be careful when debugging assemblies that are in the GAC as you may need to do an iisreset to ensure ASP.NET uses the latest version of your assembly.       *        ",[254,343,344],{},"The .pdb file needs to be in the same directory as the assembly to see line numbers",".",[32,347,348],{},"This is easy if you are using the bin directory of the website (recommended when developing), but you cannot copy these files directly into the GAC. You can get around this with the following steps:                  * Map a network drive to the GAC (C:\\WINDOWS\\assembly) folder.",[32,350,351],{},"This allows you to see the actual folder structure and copy files into the folders as they appear on disk (opposed to the shell that is shown when browsing directly).           * Copy the .pdb file into your assembly folder in the GAC_MSIL subfolder so that it sits next to the assembly dll.",[353,354,355],"ul",{},[356,357,358,361,362,368,369,368,377,368,382],"li",{},[254,359,360],{},"Activate features through the UI if you want to debug feature receivers",". If you use the stsadm command line tool to automate feature deployment the w3wp process will be recycled so any debuggers will be detached. Activating these through the central admin or the site features page will ensure the w3wp process is running.       ",[326,363,364,365,65],{},"    ",[254,366,367],{},"Use Debug and Trace statements","  ",[326,370,371,372,376],{},"   System.Diagnostics.Debug and Trace statements are another great way of tracking down errors in your code. As Debug calls are removed from release builds, these can be used extensively to help track down errors in development. To view these you can use tools such as\n",[290,373,375],{"href":374},"http:\u002F\u002Fwww.microsoft.com\u002Ftechnet\u002Fsysinternals\u002Futilities\u002Fdebugview.mspx","DebugView"," to view messages on local or remote machines ",[326,378,328,379,65],{},[254,380,381],{},"Use Try-Catch statements",[326,383,384],{},"   As with standard ASP.NET applications, Try-Catch statements can help catch and log error messages that occur in your code. This can be combined with Debug and Trace statements to view or log errors, or display meaningful messages to the user.\nFor example in a web control you might do the following:",[36,386,390],{"className":387,"code":388,"language":389,"meta":11,"style":11},"language-csharp shiki shiki-themes github-light github-dark","protected override void Render(HtmlTextWriter writer)      \n{       \n    try       \n    {       \n        \u002F\u002F code that might cause an error       \n    }       \n    catch       \n    {       \n        Trace.Write(ex);       \n        writer.Write(ex.Message);       \n    }       \n} \n","csharp",[391,392,393,400,405,411,417,423,429,435,440,446,452,457],"code",{"__ignoreMap":11},[41,394,397],{"class":395,"line":396},"line",1,[41,398,399],{},"protected override void Render(HtmlTextWriter writer)      \n",[41,401,402],{"class":395,"line":12},[41,403,404],{},"{       \n",[41,406,408],{"class":395,"line":407},3,[41,409,410],{},"    try       \n",[41,412,414],{"class":395,"line":413},4,[41,415,416],{},"    {       \n",[41,418,420],{"class":395,"line":419},5,[41,421,422],{},"        \u002F\u002F code that might cause an error       \n",[41,424,426],{"class":395,"line":425},6,[41,427,428],{},"    }       \n",[41,430,432],{"class":395,"line":431},7,[41,433,434],{},"    catch       \n",[41,436,438],{"class":395,"line":437},8,[41,439,416],{},[41,441,443],{"class":395,"line":442},9,[41,444,445],{},"        Trace.Write(ex);       \n",[41,447,449],{"class":395,"line":448},10,[41,450,451],{},"        writer.Write(ex.Message);       \n",[41,453,455],{"class":395,"line":454},11,[41,456,428],{},[41,458,460],{"class":395,"line":459},12,[41,461,462],{},"}\n",[32,464,465,468,469,473],{},[254,466,467],{},"View the SharePoint Logs","\nThe raw SharePoint log files are extremely cluttered and hard to use but there is an alternative. The ",[290,470,472],{"href":471},"http:\u002F\u002Fwww.codeplex.com\u002Ffeatures\u002FRelease\u002FProjectReleases.aspx?ReleaseId=2502","LogViewer feature on CodePlex"," lets you easily select a log file and view a filtered display of the items you are interested in.    ",[326,475,476],{},"   You can also tweak the information that is written to the SharePoint logs via the Diagnostic Logging link under Logging and Reporting in the operations section of Central Administration.",[478,479,480],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":482},[],"2015-04-20T08:07:18.2100000-04:00",{},"\u002Farticles\u002Fsharepoint-wss-3-0-tips-debugging",{"title":319,"description":232},"articles\u002Fsharepoint-wss-3-0-tips-debugging",[18],"a4E2rqcS5lz36oL5AbpTT_W92wj7pXV4YGKqJglbkn0",{"id":491,"title":492,"author":28,"body":493,"createdAt":511,"description":232,"extension":15,"img":232,"meta":512,"navigation":19,"path":513,"seo":514,"stem":515,"tags":516,"updatedAt":511,"__hash__":517},"articles\u002Farticles\u002Fdetermine-sharepoint-site-master-page-in-use.md","Determine SharePoint Site Master Page (in use)",{"type":8,"value":494,"toc":509},[495,498,506],[32,496,497],{},"Where to change the master page?     Well, if you don’t have the Publishing feature activated navigate\nto",[32,499,500,503,505],{},[290,501,502],{"href":502},"http:\u002F\u002Fyour_server\u002Fsites\u002Fexamples\u002F_Layouts\u002FChangeSiteMasterPage.aspx",[251,504],{},"\n ",[32,507,508],{},"If you do have the Publishing feature enabled you can go to Master Page on the Site Settings page, under Look and Feel category.",{"title":11,"searchDepth":12,"depth":12,"links":510},[],"2015-04-20T08:07:16.9200000-04:00",{},"\u002Farticles\u002Fdetermine-sharepoint-site-master-page-in-use",{"title":492,"description":232},"articles\u002Fdetermine-sharepoint-site-master-page-in-use",[18],"KoxFTdAecJ_3-UaaVIfPKuSarqQLbJypID67sC3-QqQ",{"id":519,"title":520,"author":28,"body":521,"createdAt":511,"description":232,"extension":15,"img":537,"meta":541,"navigation":19,"path":542,"seo":543,"stem":544,"tags":545,"updatedAt":511,"__hash__":546},"articles\u002Farticles\u002Fsharepoint-2010-iterating-sites-com-factory-error.md","SharePoint 2010 Iterating Sites–COM Factory Error",{"type":8,"value":522,"toc":539},[523,526,529],[32,524,525],{},"Platform: Windows 7, 64 bit, .NET 4 Windows App\u002FConsole App     Error: Retrieving the COM class factory for\ncomponent with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not\nregistered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).   ",[32,527,528],{},"Solution: Your debug configuration must use x64 as its active solution platform.",[32,530,531,532,534],{},"Otherwise you're going to get a very non-intuitive message like that shown above.  You can change this by picking Configuration\nManager from the Build menu or from the Solution Configurations drop down menu in your toolbar. Make sure the Active Solution Platform is not x86.",[251,533],{},[535,536],"img",{"src":537,"alt":11,"style":538},"\u002Farticles\u002Fimages\u002Ferror.jpg","display:none;",{"title":11,"searchDepth":12,"depth":12,"links":540},[],{},"\u002Farticles\u002Fsharepoint-2010-iterating-sites-com-factory-error",{"title":520,"description":232},"articles\u002Fsharepoint-2010-iterating-sites-com-factory-error",[18],"BsSgOHf3cn3e90uu93Lgc55IUUa_cRQha4xY_nFeEkc",{"id":548,"title":549,"author":28,"body":550,"createdAt":563,"description":232,"extension":15,"img":560,"meta":564,"navigation":19,"path":565,"seo":566,"stem":567,"tags":568,"updatedAt":563,"__hash__":569},"articles\u002Farticles\u002Fnet-4-with-sharepoint-foundation-2010.md",".Net 4 with SharePoint Foundation 2010",{"type":8,"value":551,"toc":561},[552,555,558],[32,553,554],{},"Error: Microsoft SharePoint is not supported with version 4.0.30319.1 of the Microsoft .Net Runtime.   ",[32,556,557],{},"The SharePoint Foundation 2010 object model is not accessible using the .NET Framework 4 (or later). Calling any object or method in the object\nmodel using any framework version other than .NET 3.5 will throw the above exception.     It is possible to access the SharePoint objects using the web\nservices interface from your .NET 4 application, but this will only allow limited functionality of the complete object model.",[535,559],{"src":560,"alt":11,"style":538},"\u002Farticles\u002Fimages\u002Ftemplate.jpg",{"title":11,"searchDepth":12,"depth":12,"links":562},[],"2015-04-20T08:07:14.8800000-04:00",{},"\u002Farticles\u002Fnet-4-with-sharepoint-foundation-2010",{"title":549,"description":232},"articles\u002Fnet-4-with-sharepoint-foundation-2010",[18],"NgPwXCaoHDkIyDZDEtzfd4_aO-RAP9En7jzpvwNPODA",{"id":571,"title":572,"author":28,"body":573,"createdAt":596,"description":577,"extension":15,"img":593,"meta":597,"navigation":19,"path":598,"seo":599,"stem":600,"tags":601,"updatedAt":596,"__hash__":602},"articles\u002Farticles\u002Fsharepoint-2010-blank-page-instead-of-site.md","SharePoint 2010 Blank Page instead of site",{"type":8,"value":574,"toc":594},[575,578,585],[32,576,577],{},"If you are getting a blank page after creating a new site (and often after creating a new web application) you may need to modify the Application Pool associated with the web application.  Open IIS and select the pool then advanced properties.  I am running SharePoint 2010 on a Windows 7 64 bit installation.",[32,579,580,581,584],{},"Ensure ‘Enable 32-Bit Applications’ is set to ",[254,582,583],{},"False"," (by default this is set to True). ",[32,586,587,588,590,591],{},"In addition, I have set the Ping Enabled to ",[254,589,583],{}," (default is True).  This will ensure that when walking through the code IIS will not time out.",[535,592],{"src":593,"alt":11,"style":538},"\u002Farticles\u002Fimages\u002FShoppingCartEmpty.jpg",{"title":11,"searchDepth":12,"depth":12,"links":595},[],"2015-04-20T08:07:14.8100000-04:00",{},"\u002Farticles\u002Fsharepoint-2010-blank-page-instead-of-site",{"title":572,"description":577},"articles\u002Fsharepoint-2010-blank-page-instead-of-site",[18],"LIrRB5mi4lrLLokTntfMiyuBnW6OZXZRQHMD3DBZUOY",{"id":604,"title":605,"author":28,"body":606,"createdAt":760,"description":761,"extension":15,"img":232,"meta":762,"navigation":19,"path":763,"seo":764,"stem":765,"tags":766,"updatedAt":760,"__hash__":767},"articles\u002Farticles\u002Ffeature-eventreceiver-get-web-context.md","Feature.EventReceiver Get Web Context",{"type":8,"value":607,"toc":758},[608,649],[32,609,610,611,613,614,616,617,619,620,622,623,505,625,627,632,633,636,637,640,641,644,645,648],{},"In order to get the current SPWeb context that the feature was activated on I have used the following extension method.  Regardless if the feature is web or site scoped the following GetWeb extension will return the current web context.",[251,612],{},"\nTypically, you would do something like the following.  This works fine if the feature is scoped for web.  If however it is scoped for Site then it will no longer work (.Parent becomes SPSite)",[251,615],{},"\nSPWeb site = (SPWeb)properties.Feature.Parent; ",[251,618],{},"\nUsing the following extension you can now use something like the following.",[251,621],{},"\nSPWeb web = properties.GetWeb();  \u002F\u002Fmuch cleaner",[251,624],{},[251,626],{},[41,628,631],{"className":629},[630],"kwrd","using"," System;\n",[41,634,631],{"className":635},[630]," System.Collections.Generic;\n",[41,638,631],{"className":639},[630]," System.Linq;\n",[41,642,631],{"className":643},[630]," System.Text;\n",[41,646,631],{"className":647},[630]," Microsoft.SharePoint;",[32,650,651,65,655,65,659,663,664,669,673,677,681,685,65,688,691,692,700,701,705,706,710,711,715,716,65,720,710,723,726,727,730,731,65,735,739,740,745,746,750,751,753,754,505,756,505],{},[41,652,654],{"className":653},[630],"public",[41,656,658],{"className":657},[630],"static",[41,660,662],{"className":661},[630],"class"," Extensions\n{\n",[41,665,668],{"className":666},[667],"rem","\u002F\u002F\u002F \u003Csummary>",[41,670,672],{"className":671},[667],"\u002F\u002F\u002F Gets the web.",[41,674,676],{"className":675},[667],"\u002F\u002F\u002F \u003C\u002Fsummary>",[41,678,680],{"className":679},[667],"\u002F\u002F\u002F \u003Cparam name=\"properties\">The properties.\u003C\u002Fparam>",[41,682,684],{"className":683},[667],"\u002F\u002F\u002F \u003Creturns>\u003C\u002Freturns>",[41,686,654],{"className":687},[630],[41,689,658],{"className":690},[630]," SPWeb\n",[41,693,695,696],{"className":694},[667],"\u002F\u002F",[290,697,698],{"href":698,"rel":699},"http:\u002F\u002Fblog.mattsmith.co.nz\u002FLists\u002FPosts\u002FPost.aspx?List=c7bdac80-1d4e-4732-9e67-cefde9c03d31&amp;ID=51",[293],"\nGetWeb(",[41,702,704],{"className":703},[630],"this"," SPFeatureReceiverProperties properties){\n    SPWeb site;\n    ",[41,707,709],{"className":708},[630],"if"," (properties.Feature.Parent ",[41,712,714],{"className":713},[630],"is"," SPWeb) {\n        site = (SPWeb)properties.Feature.Parent;\n    } ",[41,717,719],{"className":718},[630],"else",[41,721,709],{"className":722},[630],[41,724,714],{"className":725},[630]," SPSite) {\n        site = ((SPSite)properties.Feature.Parent).RootWeb;\n    } ",[41,728,719],{"className":729},[630]," {\n        ",[41,732,734],{"className":733},[630],"throw",[41,736,738],{"className":737},[630],"new"," Exception(",[41,741,744],{"className":742},[743],"str","\"Unable to retrieve SPWeb - this feature is not Site or Web-scoped.\"",");\n    }\n    ",[41,747,749],{"className":748},[630],"return"," site;\n    }\n}",[251,752],{},"\nCool eh?",[251,755],{},[251,757],{},{"title":11,"searchDepth":12,"depth":12,"links":759},[],"2015-04-20T08:07:14.5400000-04:00","In order to get the current SPWeb context that the feature was activated...",{},"\u002Farticles\u002Ffeature-eventreceiver-get-web-context",{"title":605,"description":761},"articles\u002Ffeature-eventreceiver-get-web-context",[18],"0dvtWcX_WjOm6yWA2aUZbBzFdRBtbbC3K1kZCZu1pz4",{"id":769,"title":770,"author":28,"body":771,"createdAt":917,"description":918,"extension":15,"img":232,"meta":919,"navigation":19,"path":920,"seo":921,"stem":922,"tags":923,"updatedAt":917,"__hash__":924},"articles\u002Farticles\u002Fsharepoint-method-return-splist-or-create-a-new-one.md","SharePoint Method–Return SPList (or Create a new one)",{"type":8,"value":772,"toc":915},[773,776,911,913],[32,774,775],{},"Method that returns an existing SPList on a SharePoint web (based on list name) or create a new one if not found.",[36,777,779],{"className":387,"code":778,"language":389,"meta":11,"style":11},"public static SPList EnsureList(SPWeb site, string listName, SPListTemplateType template, bool onQuickLaunch) {  \n      \n    SPList list = null;  \n    Guid listID = Guid.Empty;  \n    if (site != null) {  \n        foreach (SPList item in site.Lists) {  \n            if (item.Title.ToLower() == listName.ToLower()) {  \n                list = item;  \n                listID = item.ID;  \n                break;  \n            }  \n        }  \n  \n        if (list == null) {  \n            listID = site.Lists.Add(listName,\"\", template);  \n            list = site.Lists[listID];  \n            list.OnQuickLaunch = onQuickLaunch;  \n            list.Update();              \n        }  \n    } else {  \n        throw new Exception(\"In EnsureSiteDataList SPWeb is null\");  \n    }  \n    return list;  \n}  \n",[391,780,781,786,791,796,801,806,811,816,821,826,831,836,841,847,853,859,865,871,877,882,888,894,900,906],{"__ignoreMap":11},[41,782,783],{"class":395,"line":396},[41,784,785],{},"public static SPList EnsureList(SPWeb site, string listName, SPListTemplateType template, bool onQuickLaunch) {  \n",[41,787,788],{"class":395,"line":12},[41,789,790],{},"      \n",[41,792,793],{"class":395,"line":407},[41,794,795],{},"    SPList list = null;  \n",[41,797,798],{"class":395,"line":413},[41,799,800],{},"    Guid listID = Guid.Empty;  \n",[41,802,803],{"class":395,"line":419},[41,804,805],{},"    if (site != null) {  \n",[41,807,808],{"class":395,"line":425},[41,809,810],{},"        foreach (SPList item in site.Lists) {  \n",[41,812,813],{"class":395,"line":431},[41,814,815],{},"            if (item.Title.ToLower() == listName.ToLower()) {  \n",[41,817,818],{"class":395,"line":437},[41,819,820],{},"                list = item;  \n",[41,822,823],{"class":395,"line":442},[41,824,825],{},"                listID = item.ID;  \n",[41,827,828],{"class":395,"line":448},[41,829,830],{},"                break;  \n",[41,832,833],{"class":395,"line":454},[41,834,835],{},"            }  \n",[41,837,838],{"class":395,"line":459},[41,839,840],{},"        }  \n",[41,842,844],{"class":395,"line":843},13,[41,845,846],{},"  \n",[41,848,850],{"class":395,"line":849},14,[41,851,852],{},"        if (list == null) {  \n",[41,854,856],{"class":395,"line":855},15,[41,857,858],{},"            listID = site.Lists.Add(listName,\"\", template);  \n",[41,860,862],{"class":395,"line":861},16,[41,863,864],{},"            list = site.Lists[listID];  \n",[41,866,868],{"class":395,"line":867},17,[41,869,870],{},"            list.OnQuickLaunch = onQuickLaunch;  \n",[41,872,874],{"class":395,"line":873},18,[41,875,876],{},"            list.Update();              \n",[41,878,880],{"class":395,"line":879},19,[41,881,840],{},[41,883,885],{"class":395,"line":884},20,[41,886,887],{},"    } else {  \n",[41,889,891],{"class":395,"line":890},21,[41,892,893],{},"        throw new Exception(\"In EnsureSiteDataList SPWeb is null\");  \n",[41,895,897],{"class":395,"line":896},22,[41,898,899],{},"    }  \n",[41,901,903],{"class":395,"line":902},23,[41,904,905],{},"    return list;  \n",[41,907,909],{"class":395,"line":908},24,[41,910,462],{},[32,912,227],{},[478,914,480],{},{"title":11,"searchDepth":12,"depth":12,"links":916},[],"2015-04-20T08:07:14.2600000-04:00","Method that returns an existing SPList on a SharePoint web",{},"\u002Farticles\u002Fsharepoint-method-return-splist-or-create-a-new-one",{"title":770,"description":918},"articles\u002Fsharepoint-method-return-splist-or-create-a-new-one",[18],"23Ps1y5WrMGsI6PnpJjW-M6_FbRRv2pr0lErNFzPytw",{"id":926,"title":492,"author":28,"body":927,"createdAt":942,"description":931,"extension":15,"img":232,"meta":943,"navigation":19,"path":944,"seo":945,"stem":946,"tags":947,"updatedAt":942,"__hash__":948},"articles\u002Farticles\u002Fdetermine-sharepoint.md",{"type":8,"value":928,"toc":940},[929,932,938],[32,930,931],{},"Where to change the master page?",[32,933,934,935],{},"Well, if you don’t have the Publishing feature activated navigate to ",[290,936,937],{"href":502},"\nhttp:\u002F\u002Fyour_server\u002Fsites\u002Fexamples\u002F_Layouts\u002FChangeSiteMasterPage.aspx",[32,939,508],{},{"title":11,"searchDepth":12,"depth":12,"links":941},[],"2015-04-20T08:07:12.2800000-04:00",{},"\u002Farticles\u002Fdetermine-sharepoint",{"title":492,"description":931},"articles\u002Fdetermine-sharepoint",[18],"ucKyHjTyPVW98QxFFGeAY6bN3vLl8zlKK1NR1vY0_Gs",1781574760102]