{"id":64,"date":"2010-06-21T18:38:21","date_gmt":"2010-06-22T00:38:21","guid":{"rendered":"http:\/\/localhost\/todd_wp\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/"},"modified":"2013-07-01T10:56:08","modified_gmt":"2013-07-01T16:56:08","slug":"create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools","status":"publish","type":"post","link":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/","title":{"rendered":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools"},"content":{"rendered":"<p><a class=\"retweet self\"><\/a><\/p>\n<p>Last week <a href=\"http:\/\/social.msdn.microsoft.com\/Profile\/en-US\/?user=Mike Morton-MSFT&amp;sp=vsg\" target=\"_blank\">Mike Morton<\/a> and the folks on the Visual Studio team released the <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/8e602a8c-6714-4549-9e95-f3700344b0d9\" target=\"_blank\">Visual Studio 2010 SharePoint Power Tools<\/a>.\u00a0 The <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/8e602a8c-6714-4549-9e95-f3700344b0d9\" target=\"_blank\">Visual Studio 2010 SharePoint Power Tools<\/a>extend the SharePoint 2010 project templates and provide the following enhancements.<\/p>\n<ol>\n<li>A sandbox-compatible Visual Web Part item template.<\/li>\n<li>Compile-time validation to ensure your code will run the the sandbox.<\/li>\n<\/ol>\n<p>This short HOW TO walks you through these features and demonstrates how to make a <strong>sandbox compatible Visual Web Part<\/strong> with the <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/8e602a8c-6714-4549-9e95-f3700344b0d9\" target=\"_blank\">Visual Studio 2010 SharePoint Power Tools<\/a>.<\/p>\n<p>To begin, go download the <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/8e602a8c-6714-4549-9e95-f3700344b0d9\" target=\"_blank\">Visual Studio 2010 SharePoint Power Tools<\/a> and install them on your SharePoint development machine.\u00a0 Make sure you have Visual Studio 2010 installed first.\u00a0 Next, open Visual Studio 2010 and create an Empty SharePoint project.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Empty%20SharePoint%20Project_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Empty SharePoint Project\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Empty%20SharePoint%20Project_thumb.png\" border=\"0\" alt=\"Empty SharePoint Project\" \/><\/a><\/p>\n<p>When the SharePoint Customization Wizard prompts you, select Deploy as a sandboxed solution.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandboxed%20Solution_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Sandboxed Solution\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandboxed%20Solution_thumb.png\" border=\"0\" alt=\"Sandboxed Solution\" \/><\/a><\/p>\n<p>After the project is created, right click the project node and select Add, then select New Item.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/New%20Item_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"New Item\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/New%20Item_thumb.png\" border=\"0\" alt=\"New Item\" \/><\/a><\/p>\n<p>In the Add New Item dialog, select Visual Web Part (Sandboxed), provide a name for the Web Part, and click Add.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandboxed%20Visual%20Web%20Part%20Item_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Sandboxed Visual Web Part Item\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandboxed%20Visual%20Web%20Part%20Item_thumb.png\" border=\"0\" alt=\"Sandboxed Visual Web Part Item\" \/><\/a><\/p>\n<p>Open the sandbox compatible Visual Web Part\u2019s .ascx file and add some code to create the controls.<\/p>\n<div class=\"csharpcode\">\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:Label<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"Label2\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span> <span class=\"attr\">Text<\/span><span class=\"kwrd\">=\"Select a ski resort and click the button to see the best lift.\"<\/span><span class=\"kwrd\">&gt;&lt;\/<\/span><span class=\"html\">asp:Label<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre><span class=\"kwrd\">&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<pre class=\"alt\">Resorts:<\/pre>\n<pre><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:DropDownList<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"ResortDropDownList\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span>Breckenridge<span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span>Arapahoe Basin<span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span>Copper Mountain<span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">asp:ListItem<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre><span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">asp:DropDownList<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<pre><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:Button<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"Button1\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span> <span class=\"attr\">Text<\/span><span class=\"kwrd\">=\"Show best lift\"<\/span> <span class=\"attr\">OnClick<\/span><span class=\"kwrd\">=\"ResortDropDownList_Click\"<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;&lt;<\/span><span class=\"html\">br<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<pre><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:Label<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"BestLiftLabel\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span> <span class=\"attr\">Text<\/span><span class=\"kwrd\">=\"Best lift:\"<\/span><span class=\"kwrd\">&gt;&lt;\/<\/span><span class=\"html\">asp:Label<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<pre class=\"alt\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">asp:Label<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"BestLiftValueLabel\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span><span class=\"kwrd\">&gt;&lt;\/<\/span><span class=\"html\">asp:Label<\/span><span class=\"kwrd\">&gt;<\/span><\/pre>\n<\/div>\n<p>\u00a0<\/p>\n<p>Open the sandbox compatible Visual Web Part\u2019s .cs file and add an event handler for the dropdown list.<\/p>\n<div class=\"csharpcode\">\n<pre class=\"alt\"><span class=\"kwrd\">protected<\/span> <span class=\"kwrd\">void<\/span> ResortDropDownList_Click(<span class=\"kwrd\">object<\/span> sender, EventArgs e)<\/pre>\n<pre>{<\/pre>\n<pre class=\"alt\">    <span class=\"kwrd\">switch<\/span> (ResortDropDownList.SelectedValue)<\/pre>\n<pre>    {<\/pre>\n<pre class=\"alt\">        <span class=\"kwrd\">case<\/span> <span class=\"str\">\"Breckenridge\"<\/span>:<\/pre>\n<pre>           BestLiftValueLabel.Text = <span class=\"str\">\"Falcon Chair\"<\/span>;<\/pre>\n<pre class=\"alt\">           <span class=\"kwrd\">break<\/span>;<\/pre>\n<pre>        <span class=\"kwrd\">case<\/span> <span class=\"str\">\"Arapahoe Basin\"<\/span>:<\/pre>\n<pre class=\"alt\">           BestLiftValueLabel.Text = <span class=\"str\">\"Palavicini\"<\/span>;<\/pre>\n<pre>           <span class=\"kwrd\">break<\/span>;<\/pre>\n<pre class=\"alt\">        <span class=\"kwrd\">case<\/span> <span class=\"str\">\"Copper Mountain\"<\/span>:<\/pre>\n<pre>            BestLiftValueLabel.Text = <span class=\"str\">\"Storm King\"<\/span>;<\/pre>\n<pre class=\"alt\">            <span class=\"kwrd\">break<\/span>;<\/pre>\n<pre>    }<\/pre>\n<pre class=\"alt\">}<\/pre>\n<\/div>\n<p><!--\n\n.csharpcode, .csharpcode pre { \tfont-size: small; \tcolor: black; \tfont-family: consolas, \"Courier New\", courier, monospace; \tbackground-color: #ffffff; \t\/*white-space: pre;*\/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { \tbackground-color: #f4f4f4; \twidth: 100%; \tmargin: 0em; } .csharpcode .lnum { color: #606060; } -->\u00a0<\/p>\n<p>In the Solution Explorer, right click the project node and select Deploy.\u00a0 Notice the WSP is deployed to the Solutions Gallery where sandboxed solutions are deployed.\u00a0 <strong>(http:\/\/&lt;server&gt;\/_catalogs\/solutions\/Forms\/AllItems.aspx)<\/strong><\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Solutions%20Gallery_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Solutions Gallery\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Solutions%20Gallery_thumb.png\" border=\"0\" alt=\"Solutions Gallery\" \/><\/a><\/p>\n<p>Add the sandbox compatible Visual Web Part to a SharePoint page and test it out.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Best%20Lift%20Web%20Part_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Best Lift Web Part\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Best%20Lift%20Web%20Part_thumb.png\" border=\"0\" alt=\"Best Lift Web Part\" \/><\/a><\/p>\n<p>Return to Visual Studio and try to add some code (to the sandbox compatible Visual Web Part) which is not permitted in the sandbox.\u00a0 In this example I added a SharePoint DateTimeControl control.<\/p>\n<pre class=\"csharpcode\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">SharePoint:DateTimeControl<\/span> <span class=\"attr\">ID<\/span><span class=\"kwrd\">=\"DateTimeControl1\"<\/span> <span class=\"attr\">runat<\/span><span class=\"kwrd\">=\"server\"<\/span> <span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<p><!--\n\n.csharpcode, .csharpcode pre { \tfont-size: small; \tcolor: black; \tfont-family: consolas, \"Courier New\", courier, monospace; \tbackground-color: #ffffff; \t\/*white-space: pre;*\/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { \tbackground-color: #f4f4f4; \twidth: 100%; \tmargin: 0em; } .csharpcode .lnum { color: #606060; } -->\u00a0<\/p>\n<p>Try to deploy the solution again and notice the error in the Error List which indicates the SharePoint DateTimeControl control is not permitted in the sandbox.<\/p>\n<p><a rel=\"lightbox\" href=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandbox%20Error_2.png\"><img decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"Sandbox Error\" src=\"https:\/\/toddbaginski.com\/blog\/images\/www_toddbaginski_com\/blog\/WindowsLiveWriter\/HOWTOCreateaSandboxedVisualWebPartwithth_10610\/Sandbox%20Error_thumb.png\" border=\"0\" alt=\"Sandbox Error\" \/><\/a><\/p>\n<p>As you can see, you can find out before runtime if the code you are trying to run in the sandbox is permitted.\u00a0 This feature, coupled with the ability to use the visual designer to create sandbox compatible Visual Web Parts certainly saves development time.\u00a0 Thanks Mike and team!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools.\u00a0 The Visual Studio 2010 SharePoint Power<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":212,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[98],"tags":[10,5,6,32,7,26,33,34],"class_list":["post-64","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint-2010","tag-custom-development","tag-helpful-code","tag-how-to-sharepoint","tag-sandbox","tag-sharepoint","tag-sharepoint-2010","tag-visual-studio","tag-visual-web-parts"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Todd Baginski\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Todd Baginski&#039;s Blog - An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski&#039;s Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-06-22T00:38:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2013-07-01T16:56:08+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@toddbaginski\" \/>\n\t\t<meta name=\"twitter:title\" content=\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski&#039;s Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@toddbaginski\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#blogposting\",\"name\":\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog\",\"headline\":\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools\",\"author\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/Devils-Head-May-2007-117-e1306807211733.jpg\",\"width\":640,\"height\":426},\"datePublished\":\"2010-06-21T18:38:21-04:00\",\"dateModified\":\"2013-07-01T10:56:08-04:00\",\"inLanguage\":\"en\",\"commentCount\":4,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#webpage\"},\"articleSection\":\"SharePoint 2010, Custom Development, Helpful Code, HOW TO: SharePoint, Sandbox, SharePoint, SharePoint 2010, Visual Studio, Visual Web Parts\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"position\":2,\"name\":\"SharePoint\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2010\\\/#listItem\",\"name\":\"SharePoint 2010\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2010\\\/#listItem\",\"position\":3,\"name\":\"SharePoint 2010\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2010\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#listItem\",\"name\":\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#listItem\",\"position\":4,\"name\":\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2010\\\/#listItem\",\"name\":\"SharePoint 2010\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\",\"name\":\"Todd Baginski\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/\",\"name\":\"Todd Baginski\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#webpage\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/\",\"name\":\"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog\",\"description\":\"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.\",\"inLanguage\":\"en\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/Devils-Head-May-2007-117-e1306807211733.jpg\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#mainImage\",\"width\":640,\"height\":426},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\\\/#mainImage\"},\"datePublished\":\"2010-06-21T18:38:21-04:00\",\"dateModified\":\"2013-07-01T10:56:08-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/\",\"name\":\"Todd Baginski's Blog\",\"description\":\"An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog\",\"inLanguage\":\"en\",\"publisher\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog","description":"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.","canonical_url":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#blogposting","name":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog","headline":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools","author":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"publisher":{"@id":"https:\/\/toddbaginski.com\/blog\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2011\/05\/Devils-Head-May-2007-117-e1306807211733.jpg","width":640,"height":426},"datePublished":"2010-06-21T18:38:21-04:00","dateModified":"2013-07-01T10:56:08-04:00","inLanguage":"en","commentCount":4,"mainEntityOfPage":{"@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#webpage"},"isPartOf":{"@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#webpage"},"articleSection":"SharePoint 2010, Custom Development, Helpful Code, HOW TO: SharePoint, Sandbox, SharePoint, SharePoint 2010, Visual Studio, Visual Web Parts"},{"@type":"BreadcrumbList","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/toddbaginski.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","position":2,"name":"SharePoint","item":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/#listItem","name":"SharePoint 2010"},"previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/#listItem","position":3,"name":"SharePoint 2010","item":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#listItem","name":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools"},"previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#listItem","position":4,"name":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools","previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/#listItem","name":"SharePoint 2010"}}]},{"@type":"Person","@id":"https:\/\/toddbaginski.com\/blog\/#person","name":"Todd Baginski"},{"@type":"Person","@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author","url":"https:\/\/toddbaginski.com\/blog\/author\/todd\/","name":"Todd Baginski"},{"@type":"WebPage","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#webpage","url":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/","name":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog","description":"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.","inLanguage":"en","isPartOf":{"@id":"https:\/\/toddbaginski.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#breadcrumblist"},"author":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"creator":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2011\/05\/Devils-Head-May-2007-117-e1306807211733.jpg","@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#mainImage","width":640,"height":426},"primaryImageOfPage":{"@id":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/#mainImage"},"datePublished":"2010-06-21T18:38:21-04:00","dateModified":"2013-07-01T10:56:08-04:00"},{"@type":"WebSite","@id":"https:\/\/toddbaginski.com\/blog\/#website","url":"https:\/\/toddbaginski.com\/blog\/","name":"Todd Baginski's Blog","description":"An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog","inLanguage":"en","publisher":{"@id":"https:\/\/toddbaginski.com\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Todd Baginski's Blog - An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog","og:type":"article","og:title":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog","og:description":"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.","og:url":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/","og:image":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg","og:image:secure_url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg","article:published_time":"2010-06-22T00:38:21+00:00","article:modified_time":"2013-07-01T16:56:08+00:00","twitter:card":"summary","twitter:site":"@toddbaginski","twitter:title":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools - Todd Baginski's Blog","twitter:description":"Last week Mike Morton and the folks on the Visual Studio team released the Visual Studio 2010 SharePoint Power Tools. The Visual Studio 2010 SharePoint Power Toolsextend the SharePoint 2010 project templates and provide the following enhancements. A sandbox-compatible Visual Web Part item template. Compile-time validation to ensure your code will run the the sandbox.","twitter:creator":"@toddbaginski","twitter:image":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg"},"aioseo_meta_data":{"post_id":"64","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2022-02-14 15:54:16","updated":"2025-06-03 20:52:21"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/\" title=\"SharePoint\">SharePoint<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/\" title=\"SharePoint 2010\">SharePoint 2010<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/toddbaginski.com\/blog"},{"label":"SharePoint","link":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/"},{"label":"SharePoint 2010","link":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2010\/"},{"label":"HOW TO: Create a Sandbox Compatible Visual Web Part with the Visual Studio 2010 SharePoint Power Tools","link":"https:\/\/toddbaginski.com\/blog\/create-a-sandbox-compatible-visual-web-part-with-the-visual-studio-2010-sharepoint-power-tools\/"}],"_links":{"self":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":6,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":805,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/64\/revisions\/805"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/media\/212"}],"wp:attachment":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}