tag:blogger.com,1999:blog-77552427930001053782024-03-12T16:43:54.050-07:00The Tactical Journal of the SharePoint CombatantScheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-7755242793000105378.post-34002055553519330712017-04-28T10:37:00.000-07:002017-04-28T19:54:16.363-07:00SharePoint 2013 Office Web Apps Server is Incompatible with Server 2016<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
As of the time of this writing <u>Office Online Server for SharePoint 2016</u> is also incompatible with <u>Windows Server 2016</u><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.mememaker.net/static/images/memes/4298108.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://www.mememaker.net/static/images/memes/4298108.jpg" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
During on-prem setup, while running either PowerShell commands: </div>
<div class="MsoNormal">
</div>
<ul>
<li>Add-WindowsFeature or </li>
<li>New-OfficeWebAppsFarm </li>
</ul>
<br />
<div class="MsoNormal">
Office Web Apps Sever for SharePoint 2013 ( or Office Online Server for SharePoint 2016 ) on a Windows Server 2016 box will produce the following error: </div>
<div class="MsoNormal">
<blockquote class="tr_bq">
The operation failed. The server did not
meet the following prerequisites: - The "Ink and Handwriting
Services" Windows Server Feature must be installed and enabled.</blockquote>
<h4>
But wait, a feature by that name is no where to be found...</h4>
</div>
<div class="MsoNormal">
In <a href="https://windowsserver.uservoice.com/forums/295047-general-feedback/suggestions/14717322-ink-and-handwriting-services"><b><i>this</i></b></a> Microsoft online forum Ned Pyle ( Windows
Server Principal Program Manager ) states: </div>
<blockquote class="tr_bq">
“Ink and Handwriting Services is now a
default part of the operating system and no longer requires a separate package
which would explain why you would not find the feature listed but you do see
the files in the Program Files path.”</blockquote>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In <a href="https://social.technet.microsoft.com/Forums/office/en-US/c8dbbcac-4636-4acb-92f4-178bfb6257a9/tp5tp4-ink-and-handwriting-services-feature-missing?forum=WinServerPreview"><b><i>this</i></b></a> other forum a Microsoft Employee further states: </div>
<blockquote class="tr_bq">
“The
feature [Ink and Handwriting Services] is no longer an optional component, and
is installed by default. <i style="font-weight: bold; text-decoration-line: underline;">This change broke the check in Office Online and
it is incorrectly failing</i>. This is a known issue and a fix is being
worked on” [emphasis added]</blockquote>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
While the latter forum states “a fix is being worked
on” its referencing SharePoint 2016 Office Online Server, not the 2013
version of Office Web Apps.<br />
<br />
(Side note: the net result is that
neither SP 2016 nor SP 2013 can run on Server 2016 because of an install check for a sub-feature
that nobody uses – confusing, I know)<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
I’ve reached out to other resources to see if any remedy
has been made, nothing so far. I doubt SPOWA 2013 will ever be supported on Server 2016, and since there is no way
around “feature-check” I have chosen to soldier-on in a Server 2012R2
environment.<br />
-SharePoint Combatant</div>
Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com1tag:blogger.com,1999:blog-7755242793000105378.post-43189268893222606892015-03-10T19:07:00.004-07:002015-03-11T18:53:18.067-07:00Add jQuery to Your Sample Page (KSUG 03.10.15)These are the steps for adding jQuery and Site.js references to your Sample Page using Designer. <br />
Don't have access to Designer? No problem. Instructions to do the same using the regular UI are further below.<br />
<br />
<h4 style="text-align: center;">
Creating the Sample Page and adding script tags using Designer</h4>
<div>
1) Open the "Site Page" folder</div>
<div>
2) On the ribbon Click "Web Part Page" drop down</div>
<div>
3) Choose "Single Web Part Page"</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLInkQXLF9ktfV_m7yGwRd_0vCccpO_v41ptW0yBQyE6EhwAgeZECA88SK-z7MtNhRb6sL7HneNiSJLC9hPv4CW82mE3oLwPYLVpGce_g1EYdF8YwPfA-Jbnv8GKf1oofLNCNiZkedB4U/s1600/Designer01NewPageFile.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLInkQXLF9ktfV_m7yGwRd_0vCccpO_v41ptW0yBQyE6EhwAgeZECA88SK-z7MtNhRb6sL7HneNiSJLC9hPv4CW82mE3oLwPYLVpGce_g1EYdF8YwPfA-Jbnv8GKf1oofLNCNiZkedB4U/s1600/Designer01NewPageFile.png" height="320" width="289" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
1) Still in the "Site Pages" folder</div>
<div class="separator" style="clear: both; text-align: center;">
2) Right Click on your newly created Sample Page</div>
<div class="separator" style="clear: both; text-align: center;">
3) Select "Edit File in Advanced Mode" from the shortcut menu</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoB3Oh9_ar7ORC1WxosXfFCzbf3_mpriRmJe8T22hw6Du-ISlVLX8SBIDqojk5Da5l6wa7zvKRyGxH6YP59k2veW0xGoIsRqhkIkEyGWHvmx20wjH8pZOS6D6Fli1f-rLir1Sn23KCI0/s1600/Designer02OpenPageToEdit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoB3Oh9_ar7ORC1WxosXfFCzbf3_mpriRmJe8T22hw6Du-ISlVLX8SBIDqojk5Da5l6wa7zvKRyGxH6YP59k2veW0xGoIsRqhkIkEyGWHvmx20wjH8pZOS6D6Fli1f-rLir1Sn23KCI0/s1600/Designer02OpenPageToEdit.png" height="235" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: right;">
1) Locate the line indicated</div>
<div class="separator" style="clear: both; text-align: right;">
2) Add the two script tags shown</div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><%-- add script tags between here... --%></span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><script type="text/javascript" src="../SiteAssets/site.js" ></script></span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><%-- ...and here --%>
</span></div>
<div class="separator" style="clear: both; text-align: right;">
<br /></div>
<div class="separator" style="clear: both; text-align: right;">
(the comment lines above and below the script tags are optional) </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVTeKpH9RcCHcEj8Jlj3FLyh3RQN_UXJupYmYdl1MAVI0BVCjws2A1s4i-dflcWe1qvQY6fcbpQ1bqxMDc-vamuy7WS9agbl5G-T4ZMRFXYqBTpRHKSHZ3nqA3KyE0vdm4QNwyQey0fCA/s1600/Designer03EditPage.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVTeKpH9RcCHcEj8Jlj3FLyh3RQN_UXJupYmYdl1MAVI0BVCjws2A1s4i-dflcWe1qvQY6fcbpQ1bqxMDc-vamuy7WS9agbl5G-T4ZMRFXYqBTpRHKSHZ3nqA3KyE0vdm4QNwyQey0fCA/s1600/Designer03EditPage.png" height="220" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h4 style="clear: both; text-align: center;">
<span style="text-align: start;">Or...Creating the Sample Page and adding script tags through the UI</span></h4>
<div>
1) Navigate to the "Site Pages" library<br />
2) On the ribbon Click "Files"<br />
3) On the ribbon drop down "New Document"<br />
4) On the ribbon select "Web Part Page"</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj13iiHCIf4JFXNfYMzmHToYKaB6jv5aLl10-1adxAToFXe7WJDo9NnVQByVaTBHlwAfLyu5gN7WTv9sXTeILTRrO5RKUZN0YvY36afWrRYFs-_-CDjfUknUBIpFHAoTFwBxTL68gDByQQ/s1600/Spo01NewPageFile.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj13iiHCIf4JFXNfYMzmHToYKaB6jv5aLl10-1adxAToFXe7WJDo9NnVQByVaTBHlwAfLyu5gN7WTv9sXTeILTRrO5RKUZN0YvY36afWrRYFs-_-CDjfUknUBIpFHAoTFwBxTL68gDByQQ/s1600/Spo01NewPageFile.png" height="253" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
After naming and saving, open the page</div>
<div class="separator" style="clear: both; text-align: center;">
1) On the ribbon Click "Page"</div>
<div class="separator" style="clear: both; text-align: center;">
2) On the Ribbon Click the "Edit Page" drop down </div>
<div class="separator" style="clear: both; text-align: center;">
3) On the Ribbon menu Click "Edit Page"</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg10MmmbU7kwbJxG1m5GYAooTXA7mqX0OYmLHu8GOk3QuPsCdrVA_RJM8wk1kfxga_yZyIT2PBiD5pPyUYXDDtFPdOIUkjCYyJfwd_nfWvq7sLT9a8rZ9F2FZr7rhH3i7Ry_rY6jlv-Gnc/s1600/Spo02EditPage.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg10MmmbU7kwbJxG1m5GYAooTXA7mqX0OYmLHu8GOk3QuPsCdrVA_RJM8wk1kfxga_yZyIT2PBiD5pPyUYXDDtFPdOIUkjCYyJfwd_nfWvq7sLT9a8rZ9F2FZr7rhH3i7Ry_rY6jlv-Gnc/s1600/Spo02EditPage.png" height="320" width="288" /></a></div>
<div style="text-align: center;">
<div style="text-align: right;">
<span style="text-align: start;">On the page Click "Add New Web Part" (not shown)</span></div>
<div style="text-align: right;">
<span style="text-align: start;">1) Click "Media and Content"</span></div>
<div style="text-align: right;">
<span style="text-align: start;">2) Click "Content Editor"</span></div>
<div style="text-align: right;">
<span style="text-align: start;">Click the "Add" button (not shown )</span></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIPKRgNDoJXUTtgvwNc0MLhJA0jNVTXgaHFe_TXeO_QSBbvCjQJXV88MXEV4-zUQ5-TAfLAMj45rfkItKD0zGipTjkff1yQyF5p9oD5k2dylIGSvuhuqUGgGcp5EF20H6b_h1CwGyqpuE/s1600/Spo03AddCewp.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIPKRgNDoJXUTtgvwNc0MLhJA0jNVTXgaHFe_TXeO_QSBbvCjQJXV88MXEV4-zUQ5-TAfLAMj45rfkItKD0zGipTjkff1yQyF5p9oD5k2dylIGSvuhuqUGgGcp5EF20H6b_h1CwGyqpuE/s1600/Spo03AddCewp.png" height="279" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
Once the Content Editor Web Part appears on the page...</div>
<div style="text-align: left;">
1) On the web part Click the drop-down-arrow</div>
<div style="text-align: left;">
2) Click "Edit Web Part" from the menu</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjC9BPCLPOgl13r2vKyJQ7PiMQ0DoGS_84yVN5Gg_0mq2UJAsO-pkkqvx100oKWf9glHDuQvyv90Wc7iH3OnlArvKDtjHVV8fGMWIgPwD975UgH159601pwhbeN-apZmf2nDd7ADW0Z5iM/s1600/Spo04EditCewp.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjC9BPCLPOgl13r2vKyJQ7PiMQ0DoGS_84yVN5Gg_0mq2UJAsO-pkkqvx100oKWf9glHDuQvyv90Wc7iH3OnlArvKDtjHVV8fGMWIgPwD975UgH159601pwhbeN-apZmf2nDd7ADW0Z5iM/s1600/Spo04EditCewp.png" height="145" width="320" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
Click "Hidden" (we don't want this web part to be visible)</div>
<div class="separator" style="clear: both; text-align: center;">
Click "Apply" or "Save" (not shown)</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuS_FVvFMBaaZoRLN2NSXFTm42SprgOA-OTbhE3V7OnMITJaeDe6w3zK7m8RrMNBC589APmNYFWWMW3zhuDZ3XISVYSkhBmaTVjZVhZN5-2g1JWA2oVrLaOJmrmDsKURria8rNQxr-EMs/s1600/Spo05HideCewp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuS_FVvFMBaaZoRLN2NSXFTm42SprgOA-OTbhE3V7OnMITJaeDe6w3zK7m8RrMNBC589APmNYFWWMW3zhuDZ3XISVYSkhBmaTVjZVhZN5-2g1JWA2oVrLaOJmrmDsKURria8rNQxr-EMs/s1600/Spo05HideCewp.png" height="161" width="200" /></a></div>
<div style="text-align: right;">
Back on the web part Click the hyperlink shown below </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiGWvqK6zwgUPk1ko3MLf8FvnNw1l3Ib7H82jiaCjVlvah8BX8fX0hn4MUw9gmtt0fZwBCxGlbqaS9ddwDdWs554T9gWhHnhH53UZTfBRJ7cltieBdXdDEoTgHhYe2KT8VoCzkIT_kauc/s1600/Spo06EditHtmlCewp.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiGWvqK6zwgUPk1ko3MLf8FvnNw1l3Ib7H82jiaCjVlvah8BX8fX0hn4MUw9gmtt0fZwBCxGlbqaS9ddwDdWs554T9gWhHnhH53UZTfBRJ7cltieBdXdDEoTgHhYe2KT8VoCzkIT_kauc/s1600/Spo06EditHtmlCewp.png" height="74" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
On the Ribbon select the "Edit HTML" menu item (not shown)</div>
<div style="text-align: left;">
The "HTML Source" dialog box will appear. </div>
<div style="text-align: left;">
1) Enter the scripts tags into the textbox<br />
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><script type="text/javascript" src="../SiteAssets/site.js" ></script></span></div>
<div>
2) Click OK</div>
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgVv8kYKwrA-aJ6jNLCwWdwFEBnxqJDxi9nLLN1jeFLwCtsFPS2Ed5h3evFLTjOUAFJXN5TFB53LjZy0wriJnAw70Ukcw_G6lKvFr7yh3VbMxnyPt8e9hhi_qs5chqQdKIIt0zhUCM46A/s1600/Spo07Tags.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgVv8kYKwrA-aJ6jNLCwWdwFEBnxqJDxi9nLLN1jeFLwCtsFPS2Ed5h3evFLTjOUAFJXN5TFB53LjZy0wriJnAw70Ukcw_G6lKvFr7yh3VbMxnyPt8e9hhi_qs5chqQdKIIt0zhUCM46A/s1600/Spo07Tags.png" height="136" width="640" /></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
Click "Stop Editing"</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJpm0XJFQCX3htu2hghNS59qltOwYGXBsdIUn32gFHeAh9wU4JUhjo-XStMYMW9b8srxC9C27t9fXB4ueZ2DXi4FdABTEsKt5xhGCd5AhfrQ431D-Lst5bMha-mm5Gq0lfRFyCkL6K-g/s1600/Spo08Done.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJpm0XJFQCX3htu2hghNS59qltOwYGXBsdIUn32gFHeAh9wU4JUhjo-XStMYMW9b8srxC9C27t9fXB4ueZ2DXi4FdABTEsKt5xhGCd5AhfrQ431D-Lst5bMha-mm5Gq0lfRFyCkL6K-g/s1600/Spo08Done.png" height="139" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Happy jQuery-ing</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-52489603979956884372015-02-08T18:32:00.001-08:002015-02-28T13:16:24.730-08:00SOLVED: SharePoint Designer Inserting Blank Lines<div style="text-align: center;">
<i>Frustrated by Designer adding unwanted blank lines to your .aspx or .master pages?</i></div>
<br />
<h3>
Here's the problem:</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-JzTAsfn4TkaqFdORHZtInS0_x9eNDgNgnsadYf_462ocyaUd4tk_8NxarqSgKwwKvr2SWFBgj_DZohbNDALHu83nZtL3cMeOka4evxq3H0fcK9XA8TnBNYu65IQSnfwVffXpC4kaX-Y/s1600/01linenumber.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-JzTAsfn4TkaqFdORHZtInS0_x9eNDgNgnsadYf_462ocyaUd4tk_8NxarqSgKwwKvr2SWFBgj_DZohbNDALHu83nZtL3cMeOka4evxq3H0fcK9XA8TnBNYu65IQSnfwVffXpC4kaX-Y/s1600/01linenumber.png" height="128" width="400" /></a></div>
<br />
The first time the file is saved in SharePoint Designer blank lines are inserted or added like this...<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1D2r4rGgN0YLwj5uxTVxVqZsMXc6K9CUCPWMPN3xICR7qobFlhlRlYqHCfg8ugyiBWLls0bH9vLlQl-qDoluZjbFIJGfFbYVkDazxSGUyLIE3oewHgaZfYS-_8YiVMWxLe1klfmMaXPQ/s1600/02linenumbers.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1D2r4rGgN0YLwj5uxTVxVqZsMXc6K9CUCPWMPN3xICR7qobFlhlRlYqHCfg8ugyiBWLls0bH9vLlQl-qDoluZjbFIJGfFbYVkDazxSGUyLIE3oewHgaZfYS-_8YiVMWxLe1klfmMaXPQ/s1600/02linenumbers.png" height="122" width="320" /></a></div>
<br />
The second time the file is saved Designer doubles the number of blank lines, plus adds an extra line - a total of three blank lines...<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvhKt8ugw8uECJA27Ir-I0_QU4ukVPocVXJlevSoTTi1qlCGcXx-t-6dLNF-v1Pz1STSGY-WlSl46sDNEbDfDrGTkq9v0JdVHWaqUGn7vy-PDneCV-rmrW78oMqApZ-wzTjeDjMMVhwMU/s1600/03linenumber.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvhKt8ugw8uECJA27Ir-I0_QU4ukVPocVXJlevSoTTi1qlCGcXx-t-6dLNF-v1Pz1STSGY-WlSl46sDNEbDfDrGTkq9v0JdVHWaqUGn7vy-PDneCV-rmrW78oMqApZ-wzTjeDjMMVhwMU/s1600/03linenumber.png" height="152" width="320" /></a></div>
<br />
<br />
<br />
The third time the file is saved it doubles again, adding one line for a total of seven blank lines...<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc65jn4GNkG-EYyyfeRd4qLyIvrg-_LsGjx9XLs2WlqGJWE9i_Ufzd-Uzfv4axJdNaWHz17D2YaABiY82QKChe-LIHzw9SfukAMR40U02Y73NZRDu-Cfi5AnWvRZwi33KogBvzvT4MOtc/s1600/04linenumber.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc65jn4GNkG-EYyyfeRd4qLyIvrg-_LsGjx9XLs2WlqGJWE9i_Ufzd-Uzfv4axJdNaWHz17D2YaABiY82QKChe-LIHzw9SfukAMR40U02Y73NZRDu-Cfi5AnWvRZwi33KogBvzvT4MOtc/s1600/04linenumber.png" height="217" width="320" /></a></div>
<br />
<br />
<br />
The fourth time the file is saved a total of fifteen blank lines appear (double previous plus one)....<br />
<br />
It's simple to see how after several iterations of changes hundreds or thousand of unwanted blank lines can be inserted.<br />
<br />
<br />
<br />
<br />
<br />
Notice the culprit here - it occurs around lines of literal text within tag-blocks...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBt8C-gVQc5mLVPbZbPdBZ-gXIjHn3b4lENIScEQt4cZb94pKt5S8OCFjQaG4NeucafT4C15gu0QAP_1om1bEGaH4nB-BRF3mwU77alk8Hbklx0SUPQz6fxK81AHCLELPyfcdkGTup_No/s1600/01literaltext.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBt8C-gVQc5mLVPbZbPdBZ-gXIjHn3b4lENIScEQt4cZb94pKt5S8OCFjQaG4NeucafT4C15gu0QAP_1om1bEGaH4nB-BRF3mwU77alk8Hbklx0SUPQz6fxK81AHCLELPyfcdkGTup_No/s1600/01literaltext.png" height="128" width="400" /></a></div>
<br />
Where ever you encounter <span style="font-family: Courier New, Courier, monospace;"><b><SharePoint:ScriptBlock></b></span> and <span style="font-family: Courier New, Courier, monospace;"><b><SharePoint:StyleBlock></b></span> tags you will experience this problem:<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span><br />
<br />
<h3>
Here's the fix (read all the way to the end):</h3>
Simply add an HTML/XML comment tag right after Script or Style Tags. Like this...<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjJHCnIrCoQyBytXJJT6mMd41ODtIddsEY4ky_w4PRVtnVsJxRI4DJMlfrT_qB1uR-NkE05JdxwKxdG4qhFFpNeJXs41qrFoI0cTbju5ZAZho-B7kfKHecZDFj2vatSDmSB3BFN0Eb8Uc/s1600/05_updated_scripttags.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjJHCnIrCoQyBytXJJT6mMd41ODtIddsEY4ky_w4PRVtnVsJxRI4DJMlfrT_qB1uR-NkE05JdxwKxdG4qhFFpNeJXs41qrFoI0cTbju5ZAZho-B7kfKHecZDFj2vatSDmSB3BFN0Eb8Uc/s1600/05_updated_scripttags.png" height="186" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
...and that's it. Fixed. Save as many times as you want - no more blank lines inserted between these tags.<br />
<br />
<h4>
Crucial Tips!</h4>
<ul>
<li>Notice that the comment tag <b><i><u>must be on the same line</u></i></b> as the <span style="font-family: Courier New, Courier, monospace;"><SharePoint:...block></span> tag. Must! If you put it on it's own line the problem will persist</li>
<li>Adding this text is necessary for every <span style="font-family: Courier New, Courier, monospace;"><SharePoint:...block></span> tag on the page.</li>
</ul>
<br />
<br />
<br />Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-34053360763583557162014-04-07T11:33:00.001-07:002014-04-07T11:34:01.526-07:00How to relocate the page-advance-control displayed at the botton of the list viewIn your SharePoint list view you want to accomplish this...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_0kPw1eRRNi_dMQxsc0kAZXzvZeBMYI-QkotOn2_l-knFXXMZPaYgpfNuJ-k-ZNTY3O_uICgY4WqPiERY0yu2sVIRkKMZDjUI1fNVp8marIAKg_0stRz5yHR4o0v8NlH7c5aAKnZwfyk/s1600/PageNavigation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_0kPw1eRRNi_dMQxsc0kAZXzvZeBMYI-QkotOn2_l-knFXXMZPaYgpfNuJ-k-ZNTY3O_uICgY4WqPiERY0yu2sVIRkKMZDjUI1fNVp8marIAKg_0stRz5yHR4o0v8NlH7c5aAKnZwfyk/s1600/PageNavigation.jpg" height="176" width="640" /></a></div>
<br />
It's simple to do - modify your custom-master-page (BTW the best practice is to NOT edit "default.master" but always use your own custom-master-page - Google how to create a custom master if you are not familiar with this)<br />
<br />
If you are working in Visual Studio (creating a site for deployment) locate and open your custom-master-page in the "Modules" folder in Solution Explorer...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY-is_AFHzVS4-BogjDQCunW40EchARhLils2Lt2K6ODUreJPoMyWYNlmAG5YvVQiwVtHngnfq-ZB5DzKD8fmHj6zGIzEgIEndRSoXmgVSiSoybWWAcfWxBJwDWVti3f67-0RnPvyz3Aw/s1600/SolExp.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY-is_AFHzVS4-BogjDQCunW40EchARhLils2Lt2K6ODUreJPoMyWYNlmAG5YvVQiwVtHngnfq-ZB5DzKD8fmHj6zGIzEgIEndRSoXmgVSiSoybWWAcfWxBJwDWVti3f67-0RnPvyz3Aw/s1600/SolExp.jpg" height="152" width="320" /></a></div>
<br />
Or if using SharePoint Designer, open your site and locate your custom-master-page in the "Master Page" folder...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi95hYdBB37M6JOHRNmtjajEBwg3JxEDamA69CxCWAhbqYhUXU-K82AbgOzThcSbdT2VA_CHsfbmpAKovfarpQdt09fr10tolGIKEyD8BT6MaZkE1T-YQjQSUqvrH3u7oUEm55fUq5RFwE/s1600/Designer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi95hYdBB37M6JOHRNmtjajEBwg3JxEDamA69CxCWAhbqYhUXU-K82AbgOzThcSbdT2VA_CHsfbmpAKovfarpQdt09fr10tolGIKEyD8BT6MaZkE1T-YQjQSUqvrH3u7oUEm55fUq5RFwE/s1600/Designer.jpg" height="174" width="320" /></a></div>
<br />
Once your custom master page is open locate </head> (the closing head tag) and just above it paste the following code...<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> <span style="background-color: yellow;"><style type="text/css"></span></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <span style="background-color: yellow;">#bottomPagingCellWPQ2 {text-align: left;}</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <span style="background-color: yellow;"></style></span></span><br />
<br />
Once added the code (in the larger context of the code block) should look something like this...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8D4Tndnz-T97y8pMFSO51jkIOBJy5-eNcvS9r7kY6SXFluJ4Z0FPK-a7wkYq7EUyg_l77m-jzyOtWriJdiwlNs7lbAjEjw1yjh1pXkqctwxmPc5tVoaKfrQWS1LyOpswvfZ73hBBgIAg/s1600/CodeContext.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8D4Tndnz-T97y8pMFSO51jkIOBJy5-eNcvS9r7kY6SXFluJ4Z0FPK-a7wkYq7EUyg_l77m-jzyOtWriJdiwlNs7lbAjEjw1yjh1pXkqctwxmPc5tVoaKfrQWS1LyOpswvfZ73hBBgIAg/s1600/CodeContext.jpg" height="183" width="320" /></a></div>
<br />
Save and deploy (from visual studio) Or Save and Check-in (SharePoint Designer). Refresh your site and now the page-advance-control is located to left in the list view.<br />
<br />
If you need to document what you've just accomplished: <i>"Updated the master page to include an inline style that overrides the "text-align" attribute from "center" to "left" on the "bottomPagingCellWPQ2" (id) table-data-cell (which is where the list-view page advance control is located)."</i><br />
<br />
Users you are developing for, who have list views with many columns, will thoroughly appreciate this enhancement. Moving the page-advance-control to a handy spot will keep them from continually scrolling to the middle of each new page.Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-38077316503599836152012-10-12T10:35:00.001-07:002013-12-30T13:28:28.362-08:00SharePoint and XSLT 1.0 - How to compare dates==============================================================<br />
<b>UPDATE:</b> Be aware that Microsofts's XSLT library <a class="internal-link download-attachment" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-07-89-73-70/date_5F00_templates.xsl">date_templates.xsl</a> contains a minor bug.<br />
Using the "getDateFromDays" template will return NaN (not-a-number) when attempting to calculate the last day of the year (12/31). All other days calculate correctly.<br />
==============================================================<br />
When it comes to performing date comparisons and calculations in SharePoint using XSLT 1.0 can be tricky, but here's a simple way<br />
<br />
Navigate out to this document library<br />
<a href="http://www.blogger.com/blogger.g?blogID=7755242793000105378">http://YourSite/Style%20Library/Forms/AllItems.aspx</a><br />
<br />
And click on the "XSL Style Sheets" link<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFQ43qqtu1oHiMMaKJ6ohm7K7r6Q84qGeRPorTa2__LpTMcgFmCtCm3AuHS5AT3ramEWJvgZxBZEivjV6HWaEdOXnuoEl9ZGkSGqIPobmUGXPwVG0VcK5k_-hU2MAcw-XDyUvb9dqhYnE/s1600/XslStyleSheetsLink.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFQ43qqtu1oHiMMaKJ6ohm7K7r6Q84qGeRPorTa2__LpTMcgFmCtCm3AuHS5AT3ramEWJvgZxBZEivjV6HWaEdOXnuoEl9ZGkSGqIPobmUGXPwVG0VcK5k_-hU2MAcw-XDyUvb9dqhYnE/s1600/XslStyleSheetsLink.png" /></a></div>
Microsoft has created an XSLT file with many handy templates for doing date calculations.<br />
Download this Microsoft XSLT file <a class="internal-link download-attachment" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-07-89-73-70/date_5F00_templates.xsl">date_templates.xsl</a> and add it to the "XSL Style Sheets" folder.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcWL1zVICvXPFEaFVEbtkA_r_vVtP23duLqkVNQj4QoqhsMOJs74vTx4VHNiMSJrUcGW5ZNZXua1XuTAD6ngInhm3qoCYVMUEE2BnxxmoBnfYJqP7bDvm7_5Ie_CjPbawdGZtfDtm_Cpg/s1600/XslStyleSheetsXsltFiles.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcWL1zVICvXPFEaFVEbtkA_r_vVtP23duLqkVNQj4QoqhsMOJs74vTx4VHNiMSJrUcGW5ZNZXua1XuTAD6ngInhm3qoCYVMUEE2BnxxmoBnfYJqP7bDvm7_5Ie_CjPbawdGZtfDtm_Cpg/s320/XslStyleSheetsXsltFiles.png" width="320" /></a></div>
Now locate the "ItemStyle.xsl" file and check it out for editing. Add these styling blocks within the item you wish to transform<br />
<br />
<code style="background-color: yellow;"><!-- This is an example using the MS date_templates templates --></code><br />
<code style="background-color: yellow;"><!-- Here it's calculating the date of tomorrow --></code><br />
<code><xsl:variable name="tomorrow"><br /><span style="white-space: pre;"> </span><xsl:call-template name="getDateFromDays"><br /><span style="white-space: pre;"> </span><!-- This template requires the date in the ISO format --><br /><span style="white-space: pre;"> </span><xsl:with-param name="paramBaseDate" select="ddwrt:TodayIso()"/><br /><span style="white-space: pre;"> </span><xsl:with-param name="paramDelta" select="1"/><br /><span style="white-space: pre;"> </span></xsl:call-template><br /></xsl:variable><br />
<br /><span style="background-color: yellow;"><!-- 1st step in date comparisons in XSLT 1.0 is to convert dates to numbers. Stripping the dashes from an ISO date converts '2012-10-10' to the number '20121010' --></span></code><br />
<code><code><xsl:variable name="tomorrowAsNumber" select="(translate($tomorrow,'-',''))" /></code></code><br />
<code><code><br /></code></code>
<code><code style="background-color: yellow;"><!-- The Content Query Web Part is returning a list of tasks that contain a field called "Due Date"</code></code><br />
<code><code><xsl:variable name="listOfTasks" select="/dsQueryResponse/Rows/Row" /></code></code><br />
<code><code><br /></code></code>
<span style="background-color: yellow;"><span style="font-family: monospace;"><!-- Count the number of "Tasks Due Now" by converting the "Due Date" criteria to a number and </span><span style="font-family: monospace;">comparing it to the "Tomorrow Number"</span><span style="font-family: monospace;"> using "less-than" --></span></span><br />
<code><code><xsl:variable name="countOfTasksDueNow" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') &lt; $tomorrowAsNumber])" /></code></code><br />
<code><code><br /></code></code>
<code><code style="background-color: yellow;"><!-- Count the number of "Tasks Due Tomorrow" by converting the "Due Date" <span style="font-family: monospace;">criteria to a number and </span>comparing it to the "Tomorrow Number" using "equals" --></code></code><br />
<div>
<code><code><xsl:variable name="countOfTasksDueTomorrow" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') = $tomorrowAsNumber])" /></code></code><br />
<code><code><br /></code></code></div>
<code style="background-color: yellow;"><!-- Count the number of "Future Tasks Due" by converting the "Due Date" criteria to a number and comparing it to the "Tomorrow Number" using "greater-than" --></code><br />
<div>
<br />
<div>
<code><xsl:variable name="countOfFutureTasks" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') &gt; $tomorrowAsNumber])" /></code><br />
<code><br /></code>
<code><br /></code></div>
</div>
Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-2501820025306571072012-10-12T07:36:00.001-07:002013-03-21T07:24:12.418-07:00SharePoint & Linq: More with lessLinq makes it easy to navigate thru a record set object of SharePoint List items.<br />
<span style="font-family: monospace;"></span><span style="font-family: monospace;">
<code><br /></code><code>// Using Statement</code></span><br />
<span style="font-family: monospace;"><code>using System.Linq;</code></span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">// Build the Query Object<br />
<code>
SPQuery queryObject = new SPQuery();<br />
queryObject.Query = </code><br />
<code>@"<where></code><br />
<code> <contains></code><br />
<code> <fieldref name="FirstName"></code><br />
<code> <value type="Text">Bob</value></code><br />
<code> </fieldref></code><br />
<code> </contains></code><br />
<code></where></code><br />
<code><orderby></code><br />
<code> <fieldref ascending="TRUE" name="Modified"></code><br />
<code> </fieldref></code><br />
<code></orderby>";</code></span>Now, here's where the magic starts<br />
Super Linq! - Retrieving list items with a single line of code!<br />
<code><span style="font-family: Times New Roman;"><br /></span></code>
<code style="font-family: monospace;"><span style="background-color: yellow;">var results = list.GetItems(queryObject).Cast<splistitem>();</span><br /><br />
</code><br />
<span style="font-family: monospace;">// Here's how to see if any records were returned</span><br />
<code style="font-family: monospace;">if (!results.Count().Equals(0))<br /><br />// Want just the Last record?</code><br />
<span style="font-family: monospace;">var resultItem = list.GetItems(</span><span style="font-family: monospace;">queryObject</span><span style="font-family: monospace;">).Cast<SPListItem>().Last();</span><br />
<code style="font-family: monospace;"><br /></code>
<code style="font-family: monospace;">// Want just the First record?</code><br />
<code style="font-family: monospace;">var resultItem = list.GetItems(queryObject).Cast<SPListItem>().First();<br /><br />
</code>Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-20215410797527490202012-03-20T06:49:00.001-07:002012-03-21T07:38:03.233-07:00How to Use "Add To All Content Types" When Creating List Columns with CodeThe "Add To All Content Types" functionality can be achieved using the "AddFieldAsXml" method with the "AddToAllContentTypes" option, see below<br />
<br />
<code> SPList currentList = currentWeb.Lists["DocLib"];<br />
SPField newField = currentList.Fields.CreateNewField(SPFieldType.Text.ToString(), "New Field2");<br />
currentList.Fields.AddFieldAsXml(newField.SchemaXml, true, SPAddFieldOptions.AddToAllContentTypes);<br />
currentList.Update();<br />
</code><br />
I found this code and an excellent explanation on this blog http://blogs.microsoft.co.il/blogs/davidbi/archive/2009/01/22/sharepoint-add-a-spfield-to-all-the-content-types-in-a-splist.aspxScheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-46540774764555824352012-03-13T08:30:00.004-07:002012-03-23T13:19:51.981-07:00Fixing the Elements.xml file causing a deployment errorHere is the error that I got:<br />
<i><b>Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object</b></i><br />
This occurs when you rename your namespace without also updating the "class" value in the Elements.xml file.<br />
<br />
Here are the contents of the Elements.xml file:<br />
<?xml version="1.0" encoding="utf-8"?><br />
<code> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"><br />
<Receivers ListTemplateId="108"><br />
<Receiver><br />
<Name>EmailReciever</Name><br />
<Type>EmailReceived</Type><br />
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly><br />
<Class><span style="background-color: yellow;"><b>MyNameSpace.MyProject.MyClass</b></span></Class><br />
<SequenceNumber>10000</SequenceNumber><br />
</Receiver><br />
</Receivers><br />
</Elements></code><br />
<br />
Here is the Feature's code:<br />
<code>using System;<br />
using System.Security.Permissions;<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.Security;<br />
using Microsoft.SharePoint.Utilities;<br />
using Microsoft.SharePoint.Workflow;<br />
namespace <span style="background-color: yellow;"><b>MyNameSpace.MyProject</b></span><br />
{</code><br />
<code> public class <span style="background-color: yellow;"><b>MyClass</b></span> : SPEmailEventReceiver<br />
{<br />
public override void EmailReceived(SPList list, SPEmailMessage emailMessage, String receiverData)<br />
{<br />
base.EmailReceived(list, emailMessage, receiverData);<br />
}<br />
}<br />
}</code><br />
<br />
The error occurs when the "class" value is not exactly "Namespace" dot "ClassName" I've highlighted the pieces above, that make up the "class" value. Since 2-part namespaces are common I've used that as an example.Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-60660294141786606992012-02-23T08:57:00.003-08:002012-02-23T13:40:18.497-08:00Comparing Fields to See if Values Have Changed in the ItemUpdating MethodYou cannot get information about what was before the event in the '-ed' EventReceiver, only in the '-ing'.<br />
<br />
So, within the <code>public override void ItemUpdating(SPItemEventProperties properties)</code> method...<br />
<br />
- The "before" updating value is obtained like this;<br />
<code>var beforeValue = properties.ListItem["Column Name"].ToString();</code><br />
<br />
- The "after" updating value is obtained like this;<br />
<code>var afterValue = properties.AfterProperties[properties.ListItem.Fields["Column Name"].InternalName];</code><br />
<br />
Before making a <code>beforeValue == afterValue</code> comparison you may need to type check these values.Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-39419040558810401932012-02-23T07:28:00.000-08:002012-02-23T07:28:58.934-08:00Changing the "Created By" Value in a SharePoint List ItemC#<br />
<br />
<code><br />
// Where "item" is of type SPItem<br />
item["Created By"] = web.EnsureUser("AD account name").ID;<br />
item.UpdateOverwriteVersion(); <br />
</code>Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-67268837921190311992012-01-26T06:37:00.000-08:002012-01-26T06:45:23.011-08:00Toggle Debugging on/off for a Custom Code Web Part in SharePointC#<br />
When I render my custom coded SharePoint Web Part, it helps to display extra information to assist me in troubleshooting. I can do this by constructing my web part like this... <br />
<code><br />
...<br />
using System.Web.UI.WebControls.WebParts;<br />
...<br />
public class MyCustomWebPart : WebPart<br />
{ <br />
protected override void CreateChildControls()<br />
{<br />
string paramOne = "One";<br />
<span style="background-color: yellow;">this.Controls.Add(new LiteralControl("paramOne=" + paramOne + <br/>));</span><br />
}<br />
}<br />
</code><br />
So that my custom Web Part displays "paramOne=One" Useful for debugging when I want know the value of internal parameters in code.<br />
<br />
However, I don't want my user's to see my debugging information. I only want to turn it on in my local browser instance. I do this by adding to the Query String "?debug=true" So on the end of my URL I append the Query String and update my <code>Controls.Add</code> statement with the following code.<br />
<br />
<code><span style="background-color: yellow;"> bool.TryParse(Page.Request.QueryString["debug"], out debugOn);<br />
if (debugOn) this.Controls.Add(new LiteralControl("paramOne=" + paramOne)); </span><br />
</code>Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-54007753065378935322012-01-25T17:18:00.000-08:002012-01-25T17:18:50.806-08:00SharePoint Set the Value of a Yes/No Field in CodeC#<br />
<br />
<code><br />
// Where "item" is of type SPItem<br />
// how to read<br />
bool result = Convert.ToBoolean(item["YesNoField"]);<br />
<br />
// how to write<br />
item["YesNoField"] = true;<br />
item.Update();<br />
</code>Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com0tag:blogger.com,1999:blog-7755242793000105378.post-18397296451850289072012-01-12T12:33:00.000-08:002012-01-26T06:32:27.531-08:00Available Headers in the SPEmailMessage ObjectIt couldn't find a complete list of email headers for Microsoft.SharePoint.Utilities.SPEmailHeader, so I've compiled one here;<br />
<br />
Here's a sample usage that will return the raw email address of the sender...<br />
<code>// emailMessage is of the type SPEmailMessage<br />
string EmailAddress = emailMessage.Headers["Return-Path"].ToString();<br />
// will return "sender@domain.com"<br />
<br />
string EmailAddress = emailMessage.Headers["From"].ToString();<br />
// will return "Sender Contact Name <sender@domain.com>"</code><br />
<br />
<table><tbody>
<tr> <td><b><u>Ordinal </u></b></td> <td><b><u>Name </u></b></td> <td><b><u>Example </u></b></td> </tr>
<tr> <td>1</td> <td>x-reciever</td> <td>"recipient@domain.com"</td> </tr>
<tr> <td>2</td> <td>Received</td> <td>"from IncomingMailServer([IP])..."</td> </tr>
<tr> <td>3</td> <td>Received</td> <td>"from IncomingMailServer([IP])..."</td> </tr>
<tr> <td>4</td> <td>From</td> <td>"Sender Contact Name <sender@domain.com>"</td> </tr>
<tr> <td>5</td> <td>To</td> <td>"Recipient Contact Name <recipient@domain.com>"</td> </tr>
<tr> <td>6</td> <td>Subject</td> <td>"Subject Text"</td> </tr>
<tr> <td>7</td> <td>Thread-Topic</td> <td>"Topic Text"</td> </tr>
<tr> <td>8</td> <td>Thread-Index</td> <td>guid</td> </tr>
<tr> <td>9</td> <td>Date</td> <td>ddd, dd mmm yyyyy hh:mm:ss +0000</td> </tr>
<tr> <td>10</td> <td>Message-ID</td> <td>"UniqueId@IncomingMailServer"</td> </tr>
<tr> <td>11</td> <td>Accept-Language</td> <td>"en-US"</td> </tr>
<tr> <td>12</td> <td>Content-Language</td> <td>"en-US"</td> </tr>
<tr> <td>13</td> <td>X-MS-Has-Attach</td> <td>"yes" or ""</td> </tr>
<tr> <td>14</td> <td>X-MS-TNEF-Correlator</td> <td>""</td> </tr>
<tr> <td>15</td> <td>x-originating-ip</td> <td>"[IP]"</td> </tr>
<tr> <td>16</td> <td>Content-Type</td> <td>??</td> </tr>
<tr> <td>17</td> <td>MIME-Version</td> <td>"1.0"</td> </tr>
<tr> <td>18</td> <td>Return-Path</td> <td>"sender@domain.com</td> </tr>
</tbody></table><br />
Here's a handy way to parse out the date...<br />
<code>DateTime sent = DateTime.Parse(emailMessage.Headers["Date"]);</code>Scheevelhttp://www.blogger.com/profile/03247403143391881730noreply@blogger.com1