<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>(code segment) &#187; script</title>
	<atom:link href="http://oldblog.ideseg.com/category/sharepoint/script/feed" rel="self" type="application/rss+xml" />
	<link>http://oldblog.ideseg.com</link>
	<description>se acabarón las espinacas</description>
	<lastBuildDate>Thu, 26 Jan 2012 17:27:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SharePoint &#8211; Modificar el tipo del campo Titulo</title>
		<link>http://oldblog.ideseg.com/2006/sharepoint-modificar-el-tipo-del-campo-titulo</link>
		<comments>http://oldblog.ideseg.com/2006/sharepoint-modificar-el-tipo-del-campo-titulo#comments</comments>
		<pubDate>Tue, 17 Jan 2006 21:27:17 +0000</pubDate>
		<dc:creator>cseg</dc:creator>
				<category><![CDATA[script]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">/post/SharePoint-Modificar-el-tipo-del-campo-Titulo.aspx</guid>
		<description><![CDATA[Lo primero advierto que esta practica no esta del todo recomendada. Pero seguro que en más de una ocasión os habéis encontrado con el problema que supone tener el campo Título pre-configurado por SharePoint, (por lo menos deja cambiarle el nombre) pero no deja de ser una limitación en muchos casos que el tipo predeterminado [...]]]></description>
			<content:encoded><![CDATA[<p><P>Lo primero advierto que esta practica no esta del todo recomendada. Pero seguro que en más de una ocasión os habéis encontrado con el problema que supone tener el campo <B>Título</B> pre-configurado por SharePoint, (por lo menos deja cambiarle el nombre) pero no deja de ser una limitación en muchos casos que el tipo predeterminado sea un campo alfanumérico de 255 caracteres. </P><br />
<P>La definición en CAML del campo <B>Título</B> es la siguiente:</P><br />
<P><br />
<DIV class=csharpcode><PRE class=alt><SPAN class=kwrd>&lt;</SPAN><SPAN class=html>Field</SPAN> <SPAN class=attr>Type</SPAN><SPAN class=kwrd>=&#8221;Text&#8221;</SPAN> <SPAN class=attr>DisplayName</SPAN><SPAN class=kwrd>=&#8221;Título&#8221;</SPAN> <SPAN class=attr>MaxLength</SPAN><SPAN class=kwrd>=&#8221;255&#8243;</SPAN> <SPAN class=attr>Name</SPAN><SPAN class=kwrd>=&#8221;Title&#8221;</SPAN> <SPAN class=attr>ColName</SPAN><SPAN class=kwrd>=&#8221;nvarchar1&#8243;</SPAN> <SPAN class=kwrd>/&gt;</SPAN></PRE></DIV><br />
<P></P><br />
<P>Algunas veces he editado este campo usando CAML y he cambiado el tipo (yo por el momento no he tenido problemas al hacerlo pero como he dicho al principio es una practica que no se aconseja). Hoy trasteando he recordado que alguien (no recuerdo quien si no lo pondría) había realizado un webpart para resetear el campo <B>Título, </B>&nbsp;de manera que después se le pudiera cambiar el tipo. De modo que he echado mano de mi webpart <B><A href="http://www.ideseg.com/csegScriptWebpart10WriteAndTestCodeDirectlyIntoYourSharepointSite.aspx">csegScript</A></B>, y en unos minutos he dado con el código. </P><br />
<P><br />
<DIV class=csharpcode><PRE class=alt><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint </PRE><PRE><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.Utilities </PRE><PRE class=alt><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.WebPartPages </PRE><PRE><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.WebControls </PRE><PRE class=alt><SPAN class=kwrd>imports</SPAN> System.Web.UI </PRE><PRE><SPAN class=kwrd>imports</SPAN> System </PRE><PRE class=alt>&nbsp;</PRE><PRE><SPAN class=kwrd>Module</SPAN> Script </PRE><PRE class=alt><SPAN class=kwrd>Public</SPAN> <SPAN class=kwrd>Sub</SPAN> Main() </PRE><PRE>&nbsp;</PRE><PRE class=alt><SPAN class=kwrd>Dim</SPAN> site <SPAN class=kwrd>As</SPAN> SPSite = SPControl.GetContextSite(System.Web.HttpContext.Current) </PRE><PRE><SPAN class=kwrd>Dim</SPAN> allSites <SPAN class=kwrd>As</SPAN> SPWebCollection = site.AllWebs </PRE><PRE class=alt><SPAN class=kwrd>Dim</SPAN> subSite <SPAN class=kwrd>As</SPAN> SPWeb = allSites(0) </PRE><PRE>&nbsp;</PRE><PRE class=alt><SPAN class=kwrd>if</SPAN> (Param1&lt;&gt;<SPAN class=str>&#8220;&#8221;</SPAN>) <SPAN class=kwrd>and</SPAN> (Param2&lt;&gt;<SPAN class=str>&#8220;&#8221;</SPAN>) <SPAN class=kwrd>then</SPAN> </PRE><PRE>&nbsp;</PRE><PRE class=alt><SPAN class=kwrd>Dim</SPAN> list <SPAN class=kwrd>as</SPAN> SPList = subSite.Lists(Param1) </PRE><PRE><SPAN class=kwrd>Dim</SPAN> field <SPAN class=kwrd>As</SPAN> SPField = list.Fields(Param2) </PRE><PRE class=alt>&nbsp;</PRE><PRE>output.WriteLine(<SPAN class=str>&#8220;&lt;br&gt;Current SchemaXml:&#8221;</SPAN> + SPEncode.HtmlEncode(field.SchemaXml)) </PRE><PRE class=alt>&nbsp;</PRE><PRE><SPAN class=kwrd>Dim</SPAN> schemaXML <SPAN class=kwrd>As</SPAN> <SPAN class=kwrd>String</SPAN> = <SPAN class=str>&#8220;&lt;Field Type=&#8221;</SPAN><SPAN class=str>&#8220;Text&#8221;</SPAN><SPAN class=str>&#8221;  DisplayName=&#8221;</SPAN><SPAN class=str>&#8220;&#8221;</SPAN> &amp; field.Title &amp; <SPAN class=str><br />
                 &#8220;&#8221;</SPAN><SPAN class=str>&#8221; MaxLength=&#8221;</SPAN><SPAN class=str>&#8220;255&#8243;</SPAN><SPAN class=str>&#8221; Name=&#8221;</SPAN><SPAN class=str>&#8220;&#8221;</SPAN> &amp; field.InternalName  &amp; <SPAN class=str>&#8220;&#8221;</SPAN><SPAN class=str>&#8221; ColName=&#8221;</SPAN><SPAN class=str>&#8220;nvarchar2&#8243;</SPAN><SPAN class=str>&#8221; /&gt;&#8221;</SPAN> </PRE><PRE class=alt>&nbsp;</PRE><PRE>output.WriteLine(<SPAN class=str>&#8220;&lt;pre&gt;&#8221;</SPAN> &amp; SPEncode.HtmlEncode(schemaXML) &amp; <SPAN class=str>&#8220;&lt;/pre&gt;&#8221;</SPAN>) </PRE><PRE class=alt>output.flush() </PRE><PRE>&nbsp;</PRE><PRE class=alt><SPAN class=kwrd>try</SPAN> </PRE><PRE>&nbsp;</PRE><PRE class=alt>field.SchemaXml = schemaXML </PRE><PRE><SPAN class=rem>&#8216;field.Update() </SPAN></PRE><PRE class=alt>output.WriteLine(<SPAN class=str>&#8220;&lt;font color=red&gt;Ok&lt;/font&gt;&#8221;</SPAN>) </PRE><PRE>&nbsp;</PRE><PRE class=alt><SPAN class=kwrd>catch</SPAN> ex <SPAN class=kwrd>As</SPAN> Exception </PRE><PRE>&nbsp;</PRE><PRE class=alt>output.WriteLine(<SPAN class=str>&#8220;&lt;font color=red&gt;Error&lt;/font&gt;&#8221;</SPAN>) </PRE><PRE>output.WriteLine(ex.Message) </PRE><PRE class=alt>&nbsp;</PRE><PRE><SPAN class=kwrd>end</SPAN> <SPAN class=kwrd>try</SPAN> </PRE><PRE class=alt>&nbsp;</PRE><PRE>output.WriteLine(<SPAN class=str>&#8220;&lt;table width=&#8217;100%&#8217;&gt;&lt;tr&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Description&lt;/td&gt;&lt;td&gt;InternalName&lt;/td&gt;&lt;td&gt;Type&lt;/td&gt;&lt;/tr&gt;&#8221;</SPAN>) </PRE><PRE class=alt>&nbsp;</PRE><PRE>output.WriteLine(<SPAN class=str>&#8220;&lt;tr&gt;&lt;td&gt;&#8221;</SPAN>+<br />
	SPEncode.HtmlEncode(field.Title)+<SPAN class=str>&#8220;&lt;/td&gt;&lt;td&gt;&#8221;</SPAN>+<br />
        SPEncode.HtmlEncode(field.Description)+<SPAN class=str>&#8220;&lt;/td&gt;&lt;td&gt;&#8221;</SPAN>+<br />
        SPEncode.HtmlEncode(field.InternalName)+<SPAN class=str>&#8220;&lt;/td&gt;&lt;td&gt;&#8221;</SPAN>+<br />
        SPEncode.HtmlEncode(field.TypeAsString)+<SPAN class=str>&#8220;&lt;/td&gt;&lt;/tr&gt;&#8221;</SPAN>) </PRE><PRE class=alt>&nbsp;</PRE><PRE>output.WriteLine(<SPAN class=str>&#8220;&lt;/table&gt;&#8221;</SPAN>) </PRE><PRE class=alt>&nbsp;</PRE><PRE><SPAN class=kwrd>End</SPAN> <SPAN class=kwrd>If</SPAN> </PRE><PRE class=alt>&nbsp;</PRE><PRE><SPAN class=kwrd>End</SPAN> <SPAN class=kwrd>Sub</SPAN> </PRE><PRE class=alt><SPAN class=kwrd>End</SPAN> Module</PRE></DIV><br />
<P></P><br />
<P>Este script requiere el nombre de la lista como Param1 y el nombre del campo a resetear como Param2.</P><br />
<P>Después de ejecutar el script y entrar a modificar la configuración de la lista y el campo, podeís cambiarle el tipo.</P><br />
<P>&nbsp;</P></p>
]]></content:encoded>
			<wfw:commentRss>http://oldblog.ideseg.com/2006/sharepoint-modificar-el-tipo-del-campo-titulo/feed</wfw:commentRss>
		<slash:comments>1417</slash:comments>
		</item>
		<item>
		<title>SharePoint &#8211; Share your csegScripts &#8211; Comparte tús csegScripts</title>
		<link>http://oldblog.ideseg.com/2005/sharepoint-share-your-csegscripts-comparte-tus-csegscripts</link>
		<comments>http://oldblog.ideseg.com/2005/sharepoint-share-your-csegscripts-comparte-tus-csegscripts#comments</comments>
		<pubDate>Mon, 17 Oct 2005 22:27:16 +0000</pubDate>
		<dc:creator>cseg</dc:creator>
				<category><![CDATA[script]]></category>

		<guid isPermaLink="false">/post/SharePoint-Share-your-csegScripts-Comparte-tus-csegScripts.aspx</guid>
		<description><![CDATA[I want to do a recopilation the csegScripts to make&#160;list template with all. If you want&#160;I&#160;can add yours scripts, please send it to me.&#160;&#160;&#160; Quero hacer una recopilacin con los scripts que usas con csegScript, y hacer una plantilla con todos ellos, si quieres que aada los tuyos, enviamelos.]]></description>
			<content:encoded><![CDATA[<p><P>I want to do a recopilation the <STRONG><A href="http://www.ideseg.com/csegScriptWebpart10WriteAndTestCodeDirectlyIntoYourSharepointSite.aspx">csegScripts </A></STRONG>to make&nbsp;list template with all. If you want&nbsp;I&nbsp;can add yours scripts, please send it to me.&nbsp;&nbsp;&nbsp;</P><br />
<P>Quero hacer una recopilacin con los scripts que usas con csegScript, y hacer una plantilla con todos ellos, si quieres que aada los tuyos, enviamelos.</P></p>
]]></content:encoded>
			<wfw:commentRss>http://oldblog.ideseg.com/2005/sharepoint-share-your-csegscripts-comparte-tus-csegscripts/feed</wfw:commentRss>
		<slash:comments>2544</slash:comments>
		</item>
		<item>
		<title>csegScript webpart  1.0 Write and Test code directly into your Sharepoint site</title>
		<link>http://oldblog.ideseg.com/2005/csegscript-webpart-1-0-write-and-test-code-directly-into-your-sharepoint-site</link>
		<comments>http://oldblog.ideseg.com/2005/csegscript-webpart-1-0-write-and-test-code-directly-into-your-sharepoint-site#comments</comments>
		<pubDate>Mon, 05 Sep 2005 12:11:15 +0000</pubDate>
		<dc:creator>cseg</dc:creator>
				<category><![CDATA[script]]></category>

		<guid isPermaLink="false">/post/csegScript-webpart-10-Write-and-Test-code-directly-into-your-Sharepoint-site.aspx</guid>
		<description><![CDATA[This weekend I have finished the first version of csegScript, now are two webparts in the package, the first webpart is the 0.99 version with some improvements in the code, the  operation basically is the same one. (See previous post) &#160; The second new webpart uses a list to store the scripts, and has three [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I have finished the first version of csegScript, now are two webparts in the package, the first webpart is the 0.99 version with some improvements in the code, the  operation basically is the same one. (<a href="http://www.ideseg.com/SharePointCsegScriptWebPartWriteAndTestCodeInsideOfSharepoint.aspx">See previous post</a>)</p>
<p>&nbsp;</p>
<p>The second new webpart uses a list to store the scripts, and has three slots to pass parameters to the webpart.  (Thanks to <a href="http://blog.spsclerics.com/">Stramit</a> by your idea)</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>The list fields are:</strong></em></span></p>
<p>&nbsp;</p>
<p><strong>Title:</strong> Script Title<br />
<strong>References:</strong> Dll necessary to execute the code (remember that are Server based paths)<br />
<strong>Code:</strong> The script code<br />
<strong>Description:</strong> Short description of the code<br />
<strong>Param1, Param2, Param3:</strong> Default values for parameters<br />
<strong>Param1Desc, Param2Desc, Param3Desc:</strong> Parameters descriptions</p>
<p>&nbsp;</p>
<p>If you uses the list you dont need add the double slash at the end of each line of code, now you can write the code in a list text field using cr-lf.</p>
<p>&nbsp;</p>
<p align="center"><img src="http://oldoldblog.ideseg.com/content//csegScript1-2.gif" alt="" border="0" /></p>
<p>&nbsp;</p>
<p>To referer the params in the code use Param1, Param2 and Param3.</p>
<p>&nbsp;</p>
<p><strong>Hello World Sample</strong></p>
<p>&nbsp;</p>
<p align="center"><img src="http://oldoldblog.ideseg.com/content//csegScript1-4.gif" alt="" border="0" /></p>
<p>&nbsp;</p>
<p align="center">Running the webpart</p>
<p>&nbsp;</p>
<p align="center"><img src="http://oldoldblog.ideseg.com/content//csegScript1-5.gif" alt="" border="0" /></p>
<p>&nbsp;<br />
When you runs the csegScript webpart you can view a combo box with all scripts that you have stored in the list and only needs select the one that you want to execute, you can view the script description and the parameters slots with your descriptions. If you changes the parameters values press apply to re-run the script. Also there is a link to the list to modify the script.</p>
<p>&nbsp;</p>
<p>Attached in the zip file is the list template.</p>
<p>&nbsp;</p>
<p><img src="http://oldoldblog.ideseg.com/content//save_16.gif" alt="" border="0" /> <a href="http://oldoldblog.ideseg.com/content//csegScriptWebPart1.zip">csegScriptWebPart1.zip (23,37 KB)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://oldblog.ideseg.com/2005/csegscript-webpart-1-0-write-and-test-code-directly-into-your-sharepoint-site/feed</wfw:commentRss>
		<slash:comments>1930</slash:comments>
		</item>
		<item>
		<title>SharePoint &#8211; Playing with csegScript</title>
		<link>http://oldblog.ideseg.com/2005/sharepoint-playing-with-csegscript</link>
		<comments>http://oldblog.ideseg.com/2005/sharepoint-playing-with-csegscript#comments</comments>
		<pubDate>Mon, 08 Aug 2005 18:31:53 +0000</pubDate>
		<dc:creator>cseg</dc:creator>
				<category><![CDATA[script]]></category>

		<guid isPermaLink="false">/post/SharePoint-Playing-with-csegScript.aspx</guid>
		<description><![CDATA[Some users of csegRollUp2 ask to me how to get the complete list of fields for a list, remember that you can use the internal names with csegRollUp. Now you can use csegScript to show all fields and types of any list.Change the red code with the name of your list, and put the webpart [...]]]></description>
			<content:encoded><![CDATA[<p><P>Some users of csegRollUp2 ask to me how to get the complete list of fields for a list, remember that you can use the internal names with csegRollUp. Now you can use csegScript to show all fields and types of any list.<BR><BR>Change the red code with the name of your list, and put the webpart in the site where the list is stored.&nbsp;<BR><B></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;FONT color=blue&gt;&lt;BR&gt;Begin Script Code&lt;/FONT&gt;&lt;/B&gt;&lt;BR&gt;&lt;CODE&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;1:&lt;/FONT&gt;imports Microsoft.SharePoint&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2:&lt;/FONT&gt;imports Microsoft.SharePoint.Utilities&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;3:&lt;/FONT&gt;imports Microsoft.SharePoint.WebPartPages&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;4:&lt;/FONT&gt;imports Microsoft.SharePoint.WebControls&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;5:&lt;/FONT&gt;imports System.Web.UI&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;6:&lt;/FONT&gt;Module Script&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;7:&lt;/FONT&gt;Public Sub Main()&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;8:&lt;/FONT&gt;Dim site As SPSite = SPControl.GetContextSite(System.Web.HttpContext.Current)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;9:&lt;/FONT&gt;Dim allSites As SPWebCollection = site.AllWebs&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;10:&lt;/FONT&gt;Dim subSite As SPWeb = allSites(0)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;11:&lt;/FONT&gt;Dim list as SPList = subSite.Lists(&quot;&lt;FONT color=#ff0000&gt;&lt;STRONG&gt;Anuncios&lt;/STRONG&gt;&lt;/FONT&gt;&quot;)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;12:&lt;/FONT&gt;Dim field As SPField&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;13:&lt;/FONT&gt;output.WriteLine(&quot;&amp;lt;table width='100%'&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Name&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Description&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;InternalName&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Type&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&quot;)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;14:&lt;/FONT&gt;For Each field in list.Fields&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;15:&lt;/FONT&gt;output.WriteLine(&quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&quot;+SPEncode.HtmlEncode(field.Title)+&quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;+SPEncode.HtmlEncode(field.Description)+&quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;+SPEncode.HtmlEncode(field.InternalName)+&quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;+SPEncode.HtmlEncode(field.TypeAsString)+&quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&quot;)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;16:&lt;/FONT&gt;Next field&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;17:&lt;/FONT&gt;output.WriteLine(&quot;&amp;lt;/table&amp;gt;&quot;)&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;18:&lt;/FONT&gt;End Sub&lt;BR&gt;&lt;FONT color=blue&gt;&amp;nbsp;&amp;nbsp;19:&lt;/FONT&gt;End Module&lt;BR&gt;</div></div>
<p><B><FONT color=blue>End Script Code</FONT></B><BR></CODE><BR>Also, some users ask to me about remove the copyright in the bottom of webpart, I think that csegScript is a tool for developpers and is not thought, for end users.And in a future I will open the code.<BR><BR><STRONG>Note:</STRONG> If you want to share your small tricks, suggest improvements with csegScript, csegRollUp or others webparts please uses the forum or comments. <STRONG>I always respond</STRONG>.</P><br />
<P>(the cut and paste code is in the forum <img src='http://oldblog.ideseg.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )<BR>&nbsp;</P></p>
]]></content:encoded>
			<wfw:commentRss>http://oldblog.ideseg.com/2005/sharepoint-playing-with-csegscript/feed</wfw:commentRss>
		<slash:comments>2523</slash:comments>
		</item>
		<item>
		<title>SharePoint &#8211; csegScriptWebPart &#8211; write and test code inside of sharepoint &#8211;</title>
		<link>http://oldblog.ideseg.com/2005/sharepoint-csegscriptwebpart-write-and-test-code-inside-of-sharepoint</link>
		<comments>http://oldblog.ideseg.com/2005/sharepoint-csegscriptwebpart-write-and-test-code-inside-of-sharepoint#comments</comments>
		<pubDate>Thu, 04 Aug 2005 21:10:41 +0000</pubDate>
		<dc:creator>cseg</dc:creator>
				<category><![CDATA[script]]></category>

		<guid isPermaLink="false">/post/SharePoint-csegScriptWebPart-write-and-test-code-inside-of-sharepoint-.aspx</guid>
		<description><![CDATA[imagine test your webparts without compile, imagine an VBA for sharepoint, that was what I imagined yesterday and this is here&#8230; I have desire to say YeahhhhhScreenshoots (better an image than thousand words) csegScript showing code &#160; csegScriptWebPart custom PropertiesShow Code – Show the code with line numbers to identificate errorsRun Code – The code [...]]]></description>
			<content:encoded><![CDATA[<p><P>imagine test your webparts without compile, imagine an VBA for sharepoint, that was what I imagined yesterday and this is here&#8230; I have desire to say Yeahhhhh<BR><BR><STRONG>Screenshoots</STRONG> (better an image than thousand words) </P><br />
<P align=center>csegScript showing code<BR><IMG src="http://oldoldblog.ideseg.com/content//csegScript1.gif" border=0></P><br />
<P align=center>&nbsp;</P><br />
<P><U><B>csegScriptWebPart custom Properties</B></U><BR><BR><B>Show Code</B> – Show the code with line numbers to identificate errors<BR><B>Run Code</B> – The code is executed when you applies changes<BR><B>Script References</B> – Write here the references of the project (.dll files)<BR><BR>If the file is in windows\system or in the assembly the path is not necesary so if you need a .dll (as Microsoft.SharePoint.dll) you need include the full path in the server, separe each reference with semicolon<BR><BR><B>Script Code</B> – Visual Basic .NET based code, (Visual studio for applications code)<BR><BR>Separate lines with “\\” double backslash, internally they are replaced by carriage returns.</P><br />
<P align=center>csegScript properties<BR><IMG src="http://oldoldblog.ideseg.com/content//csegScript2.gif" border=0></P><br />
<P><BR><BR><U><B>Sample script code</B></U></P><br />
<P>This sample code shows all lists in the current site and in subsites with a link to the default list view.&nbsp;(the source is included in the zip file)</P><br />
<STYLE type=text/css><br />
.csharpcode<br />
{<br />
	font-size: 11px;<br />
	color: black;<br />
	font-family: Courier New , Courier, Monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt<br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}</p>
<p>.csharpcode .lnum { color: #606060; }<br />
</STYLE></p>
<p><DIV class=csharpcode><PRE><SPAN class=lnum>   1:  </SPAN><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint</PRE><PRE><SPAN class=lnum>   2:  </SPAN><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.Utilities</PRE><PRE><SPAN class=lnum>   3:  </SPAN><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.WebPartPages</PRE><PRE><SPAN class=lnum>   4:  </SPAN><SPAN class=kwrd>imports</SPAN> Microsoft.SharePoint.WebControls</PRE><PRE><SPAN class=lnum>   5:  </SPAN><SPAN class=kwrd>imports</SPAN> System.Web.UI</PRE><PRE><SPAN class=lnum>   6:  </SPAN><SPAN class=kwrd>Module</SPAN> Script</PRE><PRE><SPAN class=lnum>   7:  </SPAN><SPAN class=kwrd>Public</SPAN> <SPAN class=kwrd>Sub</SPAN> Main()</PRE><PRE><SPAN class=lnum>   8:  </SPAN>   <SPAN class=kwrd>Dim</SPAN> site <SPAN class=kwrd>As</SPAN> SPSite = SPControl.GetContextSite(System.Web.HttpContext.Current)   </PRE><PRE><SPAN class=lnum>   9:  </SPAN>   <SPAN class=kwrd>Dim</SPAN> allSites <SPAN class=kwrd>As</SPAN> SPWebCollection = site.AllWebs</PRE><PRE><SPAN class=lnum>  10:  </SPAN>   <SPAN class=kwrd>Dim</SPAN> subSite <SPAN class=kwrd>As</SPAN> SPWeb</PRE><PRE><SPAN class=lnum>  11:  </SPAN>   <SPAN class=kwrd>For</SPAN> <SPAN class=kwrd>Each</SPAN> subSite <SPAN class=kwrd>In</SPAN> allSites</PRE><PRE><SPAN class=lnum>  12:  </SPAN>      <SPAN class=kwrd>Dim</SPAN> allSiteLists <SPAN class=kwrd>As</SPAN> SPListCollection = subSite.Lists</PRE><PRE><SPAN class=lnum>  13:  </SPAN>      <SPAN class=kwrd>Dim</SPAN> subSiteList <SPAN class=kwrd>As</SPAN> SPList</PRE><PRE><SPAN class=lnum>  14:  </SPAN>      <SPAN class=kwrd>For</SPAN> <SPAN class=kwrd>Each</SPAN> subSiteList <SPAN class=kwrd>In</SPAN>  allSiteLists</PRE><PRE><SPAN class=lnum>  15:  </SPAN>         output.WriteLine(<SPAN class=str>&#8220;&lt;IMG SRC=&#8217;&#8221;</SPAN>+subSiteList.ImageUrl+<SPAN class=str>&#8220;&#8216;&gt;&lt;/IMG&gt;&#8221;</SPAN> &amp; <SPAN class=str>&#8221; &#8220;</SPAN> &amp; _</PRE><PRE>                                 SPEncode.HtmlEncode(subSite.Name) &amp; <SPAN class=str>&#8221; :: &#8220;</SPAN> &amp; <SPAN class=str>_</SPAN></PRE><PRE><SPAN class=str>                                 &#8220;&lt;A HREF=&#8217;&#8221;</SPAN> + subSiteList.DefaultViewUrl &amp; <SPAN class=str>&#8220;&#8216;&gt;&#8221;</SPAN> &amp; _</PRE><PRE>                                 SPEncode.HtmlEncode(subSiteList.Title) &amp; <SPAN class=str>_</SPAN></PRE><PRE><SPAN class=str>                                 &#8220;&lt;/A&gt;&lt;BR&gt;&#8221;</SPAN>)</PRE><PRE><SPAN class=lnum>  16:  </SPAN>      <SPAN class=kwrd>Next</SPAN> subSiteList</PRE><PRE><SPAN class=lnum>  17:  </SPAN>   <SPAN class=kwrd>Next</SPAN> subSite</PRE><PRE><SPAN class=lnum>  18:  </SPAN><SPAN class=kwrd>End</SPAN> <SPAN class=kwrd>Sub</SPAN></PRE><PRE><SPAN class=lnum>  19:  </SPAN><SPAN class=kwrd>End</SPAN> Module</PRE><PRE>&nbsp;</PRE><PRE>&nbsp;</PRE></DIV><br />
<P><STRONG><U>Special<BR><BR></U></STRONG>There is two special keys (<B>output</B> and <B>_this</B>)<BR><BR>output (internally is an HtmlTextWriter object) that you can use in the script code.<BR><BR></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Sample: output.WriteLine(“Hello Sharepoint Developpers”)</div></div>
<p><BR><BR>_this is a reference to the webpart (internally is a WebPart object)<BR><BR></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Sample: output.WriteLine(_this.Title)</div></div>
<p>&nbsp;<BR>&nbsp;</P><br />
<P><STRONG><U>Usage in six steps….</U></STRONG></P><br />
<P>1.- Unmark “Run Script”&nbsp; and mark “Show Script Source”<BR>2.- Put your code in the properties window, after each line put \\ instead of newline.<BR>3.- Add your system references in the Script References, separated by semicolon (remenber the full path if they are not in assembly)<BR>4.- Apply changes<BR>5.- If there&nbsp;are errors you can view the error description, line number and line text, solve the problems and apply changes.<BR></P><br />
<P align=center><IMG src="http://oldoldblog.ideseg.com/content//csegScript4.gif" border=0></P><br />
<P><BR><BR>6.- When all is correct mark “Run Script” and VOILA….</P><br />
<P align=center><IMG src="http://oldoldblog.ideseg.com/content//csegScript3.gif" border=0></P><br />
<P align=center>&nbsp;</P><A href="http://oldoldblog.ideseg.com/content//csegScriptWebPart.zip">Download csegScriptWebPart.zip (7,91 KB)</A></p>
]]></content:encoded>
			<wfw:commentRss>http://oldblog.ideseg.com/2005/sharepoint-csegscriptwebpart-write-and-test-code-inside-of-sharepoint/feed</wfw:commentRss>
		<slash:comments>2119</slash:comments>
		</item>
	</channel>
</rss>

