<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.inetium.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Kirk Hofer</title><subtitle type="html" /><id>http://blogs.inetium.com/blogs/khofer/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.inetium.com/blogs/khofer/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.inetium.com/blogs/khofer/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.31106.3070">Community Server</generator><updated>2007-11-13T20:09:00Z</updated><entry><title>SPFile Upload Invalid Characters</title><link rel="alternate" type="text/html" href="/blogs/khofer/archive/2008/05/07/spfile-upload-invalid-characters.aspx" /><id>/blogs/khofer/archive/2008/05/07/spfile-upload-invalid-characters.aspx</id><published>2008-05-08T02:11:00Z</published><updated>2008-05-08T02:11:00Z</updated><content type="html">&lt;p&gt;If you are like me and have uploaded a bunch of files to SharePoint then you have had the weird character issue.&amp;nbsp; Use this Regex to clean it.&amp;nbsp; This can be tweaked to run in PowerShell as well...&amp;nbsp;&lt;/p&gt;
&lt;p style="FONT-SIZE:11pt;MARGIN:0in;FONT-FAMILY:Calibri;"&gt;////\/:*?&amp;quot;&amp;lt;&amp;gt;|#{}%~&amp;amp;&lt;/p&gt;
&lt;p style="FONT-SIZE:11pt;MARGIN:0in;FONT-FAMILY:Calibri;"&gt;public static string CleanSPFileName(string fileName)&lt;br /&gt;{&lt;/p&gt;
&lt;p style="FONT-SIZE:11pt;MARGIN:0in;FONT-FAMILY:Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return System.Text.RegularExpressions.Regex.Replace(fileName, &amp;quot;(&lt;a&gt;\\?|\\:|\\~|\\#|\\{|\\}|\\&amp;amp;|%|[|]|\\*|\\?|\\\\|\\/|\\&amp;lt;|\\&amp;gt;|\&amp;quot;+)+&lt;/a&gt;&amp;quot;, &amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p style="FONT-SIZE:11pt;MARGIN:0in;FONT-FAMILY:Calibri;"&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.inetium.com/aggbug.aspx?PostID=17343" width="1" height="1"&gt;</content><author><name>khofer</name><uri>http://blogs.inetium.com/members/khofer/default.aspx</uri></author><category term="SharePoint" scheme="http://blogs.inetium.com/blogs/khofer/archive/tags/SharePoint/default.aspx" /></entry><entry><title>FIX: Can't Move/Copy an SPListItem</title><link rel="alternate" type="text/html" href="/blogs/khofer/archive/2008/03/16/fix-can-t-move-copy-an-splistitem.aspx" /><id>/blogs/khofer/archive/2008/03/16/fix-can-t-move-copy-an-splistitem.aspx</id><published>2008-03-17T01:22:00Z</published><updated>2008-03-17T01:22:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;STRONG&gt;&lt;U&gt;Problem:&lt;o:p&gt;&lt;/o:p&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;SPListItem.CopyTo() does not work.&amp;nbsp; You always get the error "Source item cannot be found.&amp;nbsp; Verify that the item exist and that you have permission to read it.".&amp;nbsp; Nice error…tells you nothing especially since you have a pointer to the item so obviously you can read it…duh.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;STRONG&gt;&lt;U&gt;Solution&lt;/U&gt;&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;I have seen several posts out there just looking through columns and creating a copy of the item by hand...yuck.&amp;nbsp;&amp;nbsp;This was so easy, that it is taking me longer to write this blog....The key is the SPListItem.Url and the name it gives to the file with &amp;lt;ID&amp;gt;_.000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;1. Get the&amp;nbsp;SPListItem.Url and then use this to get a pointer to the SPFile object.&amp;nbsp; Of course, you can't just hit the SPListItem.File since this is not a document library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;2. Use the SPFile.MoveTo() method and you are done&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;SPListItem item = Web.Lists["Announcement"].GetItemById(5);
SPFile file = Web.GetFile(item.Url);
file.MoveTo("New location...with the ID_.000");
&lt;/PRE&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Arial','sans-serif';"&gt;Enjoy!&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.inetium.com/aggbug.aspx?PostID=16220" width="1" height="1"&gt;</content><author><name>khofer</name><uri>http://blogs.inetium.com/members/khofer/default.aspx</uri></author><category term="SharePoint" scheme="http://blogs.inetium.com/blogs/khofer/archive/tags/SharePoint/default.aspx" /></entry><entry><title>Simple SharePoint Warm Up Script</title><link rel="alternate" type="text/html" href="/blogs/khofer/archive/2007/11/13/simple-sharepoint-warm-up-script.aspx" /><id>/blogs/khofer/archive/2007/11/13/simple-sharepoint-warm-up-script.aspx</id><published>2007-11-14T02:09:00Z</published><updated>2007-11-14T02:09:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;UPDATED: Check out my new blog for a new and improved version that actually works&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://kirkhofer.wordpress.com/2008/10/18/sharepoint-warm-up-script"&gt;http://kirkhofer.wordpress.com/2008/10/18/sharepoint-warm-up-script&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kirkhofer.com"&gt;http://www.kirkhofer.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.inetium.com/aggbug.aspx?PostID=9134" width="1" height="1"&gt;</content><author><name>khofer</name><uri>http://blogs.inetium.com/members/khofer/default.aspx</uri></author><category term="SharePoint" scheme="http://blogs.inetium.com/blogs/khofer/archive/tags/SharePoint/default.aspx" /><category term="PowerShell" scheme="http://blogs.inetium.com/blogs/khofer/archive/tags/PowerShell/default.aspx" /><category term="IW 2007" scheme="http://blogs.inetium.com/blogs/khofer/archive/tags/IW+2007/default.aspx" /></entry></feed>