tag:blogger.com,1999:blog-25487224500336036232024-03-13T10:17:10.990-07:00Guruprasad MaratheGuruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-2548722450033603623.post-49710496524161915232018-09-17T12:49:00.000-07:002018-11-05T11:24:53.383-08:00Handy Functions<meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.msonormal, li.msonormal, div.msonormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.msohyperlink
{mso-style-priority:99;
color:#0563c1;
text-decoration:underline;}
a:visited, span.msohyperlinkfollowed
{mso-style-priority:99;
color:#954f72;
text-decoration:underline;}
span.emailstyle17
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.emailstyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1f497d;}
.msochpdefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page wordsection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.wordsection1
{page:wordsection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div class="WordSection1"><table class="MsoTableGrid" style="border: currentcolor; border-image: none; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td width="561" valign="top" style="padding: 0in 5.4pt; border: 1pt solid windowtext; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> ReadCSV()<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> LogInfoMessage(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"CSV loading..."</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstSiteURLs = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">>();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">using</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> reader = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StreamReader</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ConfigurationManager</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.AppSettings.Get(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Constants</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.CSV_FILE_PATH), </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Encoding</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.Default))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">int</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> i = 0;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">while</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (!reader.EndOfStream)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> url = reader.ReadLine();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (i > 0)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstSiteURLs.Add(url);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> i++;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> LogInfoMessage(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"CSV loaded successfully..."</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstSiteURLs;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> LogErrorMessage(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Error occured in ReadCSV. Error details- "</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> + ex.Message);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">NetworkCredential</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> GetCredentials()<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">NetworkCredential</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">(<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ConfigurationManager</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.AppSettings.Get(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Constants</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.ADMIN_USER_NAME),<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ConfigurationManager</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.AppSettings.Get(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Constants</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.ADMIN_USER_PASS),<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ConfigurationManager</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.AppSettings.Get(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Constants</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.DOMAIN)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> );<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> LogErrorMessage(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Error occured in GetCredentials. Error details- "</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> + ex.Message);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AddUserAsSiteAdmin(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstSites)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> logFilePath = </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ConfigurationManager</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.AppSettings.Get(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Constants</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.FILE_PATH);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">IEnumerable</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstCollection = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">foreach</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> siteURL </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">in</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstSites)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (!</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.IsNullOrWhiteSpace(siteURL))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">bool</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExists = </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Helper</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.IsSiteExist(siteURL, logFilePath);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (isSiteExists)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">using</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext = GetClientContext(GetSafeURL(siteURL)))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">User</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> spUser = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> spUser = clientContext.Web.EnsureUser(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"i:loinginfo "</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> spUser.IsSiteAdmin = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> spUser.Update();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.Load(spUser);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">continue</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> GetClientContext(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> siteURL)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">(GetSafeURL(siteURL));<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.ExecutingWebRequest += Ctx_ExecutingWebRequest;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.Credentials = GetCredentials();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.RequestTimeout = -1;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.PendingRequest.RequestExecutor.RequestKeepAlive = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.PendingRequest.RequestExecutor.WebRequest.KeepAlive = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.PendingRequest.RequestExecutor.WebRequest.Timeout = -1;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.PendingRequest.RequestExecutor.WebRequest.ReadWriteTimeout = -1;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> LogErrorMessage(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Error occured in GetClientContext. Error details- "</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> + ex.Message);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">private</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> Ctx_ExecutingWebRequest(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">object</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> sender, </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">WebRequestEventArgs</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> e)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (e != </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> e.WebRequestExecutor.WebRequest.Headers.Add(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"X-FORMS_BASED_AUTH_ACCEPTED"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">, </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"f"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">bool</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> IsSiteExist(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> siteURL, </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> logFilePath)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">bool</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExist = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context = GetClientContext(GetSafeURL(siteURL));<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.Credentials = GetCredentials();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Web</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> oWebsite = context.Web;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.Load(oWebsite);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (oWebsite != </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExist = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExist = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">finally</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> context.Dispose();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExist;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> GetSafeURL(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> url)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (url.Trim().EndsWith(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"/"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> url.TrimEnd(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'/'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">else</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> url;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ProgressReportLogging(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> message, </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> filepath)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> strPath = filepath;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (!System.IO.</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">File</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.Exists(strPath))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> System.IO.</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">File</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.Create(strPath).Dispose();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">//using (StreamWriter sw = System.IO.File.AppendText(strPath))</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">//{</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">// sw.WriteLine(message);</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">//}</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">using</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StreamWriter</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> sw = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StreamWriter</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">(strPath, </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">, </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Encoding</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.Default))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> sw.WriteLine(message);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AddChoiceItemList(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstSites)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">IEnumerable</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstCollection = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> list = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">foreach</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> siteURL </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">in</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstSites)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">try</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (!</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.IsNullOrWhiteSpace(siteURL))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">bool</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isSiteExists = </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Helper</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">.IsSiteExist(siteURL, LogFilePath);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (isSiteExists)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">using</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext = GetClientContext(GetSafeURL(siteURL)))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstCollection = clientContext.LoadQuery(clientContext.Web.Lists.Where(l => l.Title == </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Entity"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">));<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> list = lstCollection.First();</span><span style="color: rgb(31, 73, 125); font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: green; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Field</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> field1 = list.Fields.GetByInternalNameOrTitle(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"ColumnName"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">FieldChoice</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> fieldChoice1 = clientContext.CastTo<</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">FieldChoice</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">>(field1);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.Load(fieldChoice1);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">// Add the choice field values </span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> options = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">>(fieldChoice1.Choices);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (!options.Contains(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Test1"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">))<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> options.Add(</span><span style="color: rgb(31, 73, 125); font-family: consolas; font-size: 9.5pt;">“</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">Test1</span><span style="color: rgb(31, 73, 125); font-family: consolas; font-size: 9.5pt;">”</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }</span><span style="color: green; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: green; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> fieldChoice1.Update();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">catch</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Exception</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ex)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">continue</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItem</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> GetAllListItemsThreshold(</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ctx, </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> list)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItem</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> items = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItem</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">>();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItemCollectionPosition</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> coll = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItemCollectionPosition</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItemCollectionPosition</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> position = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">int</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> rowLimit = 4999;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> camlQuery = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">CamlQuery</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> camlQuery.ViewXml = </span><span style="color: maroon; font-family: consolas; font-size: 9.5pt;">@"<View Scope='RecursiveAll'><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> <Query><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> <OrderBy Override='TRUE'><FieldRef Name='ID'/></OrderBy> <o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> </Query><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> <ViewFields><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> <FieldRef Name='FileLeafRef'/><FieldRef Name='File_x0020_Size'/><FieldRef Name='FileLeafRef'/><FieldRef Name='File_x0020_Type' /><FieldRef Name='FileRef' /><FieldRef Name='Editor' /><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> </ViewFields><o:p></o:p></span></p><p class="MsoNormal"><span style="color: maroon; font-family: consolas; font-size: 9.5pt;"> <RowLimit Paged='TRUE'>"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> + rowLimit + </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"</RowLimit></View>"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">do</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ListItemCollection</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> listItems = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> camlQuery.ListItemCollectionPosition = position;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> listItems = list.GetItems(camlQuery);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ctx.Load(listItems);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ctx.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> position = listItems.ListItemCollectionPosition;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> items.AddRange(listItems.ToList());<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">while</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (position != </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> items = items.OrderBy(item => item.FieldValues[</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"FileLeafRef"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">]).ToList();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">return</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> items;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">public</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">static</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> GetContentTypeListInfo(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> List_NAME, </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> EntInflogFilePath,</span><span style="color: rgb(31, 73, 125); font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ClientContext</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext, </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> contentTypeName)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">bool</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isExists = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">IEnumerable</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">> lstCollection = clientContext.LoadQuery(clientContext.Web.Lists.Where(l => l.Title == List_NAME));<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> count = lstCollection.Count();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (count >= 1)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">foreach</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">List</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ls </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">in</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> lstCollection)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.Load(ls.ContentTypes);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.Load(ls.Fields);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ctCOunt = ls.ContentTypes.Count;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (ctCOunt > 0)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isExists = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">foreach</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">ContentType</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ct </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">in</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ls.ContentTypes)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (ct.Name != </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"Folder"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.Load(ct.Fields);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> clientContext.ExecuteQuery();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StringBuilder</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> fields = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StringBuilder</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StringBuilder</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> internames = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">new</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">StringBuilder</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">();<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> isExists = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">foreach</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (</span><span style="color: rgb(43, 145, 175); font-family: consolas; font-size: 9.5pt;">Field</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> fld </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">in</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ct.Fields)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> fields.Append(fld.Title + </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">";"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> internames.Append(fld.InternalName + </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">";"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="text-indent: 0.5in; margin-left: 1.5in;"><span style="color: green; font-family: consolas; font-size: 9.5pt;">//do something</span><span style="color: rgb(31, 73, 125);"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">else</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (ctCOunt == 0)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">//do something</span><span style="color: rgb(31, 73, 125);"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">else</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (lstCollection == </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">null</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> || count == 0)<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: green; font-family: consolas; font-size: 9.5pt;">//do something</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><o:p></o:p></p><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p><p>public static void Get_Item_Level_Permissions_For_All_List_Items()<p>{<p>string logFilePath = AppDomain.CurrentDomain.BaseDirectory + "ItemlevelPermission_" + string.Format("{0:yyyy-MM-dd_hh-mm-ss}", DateTime.Now) + ".csv";<p>string header = "SiteUrl,ListName,ListHasUniqueRoleAssignments,Status,Message,ItemID,ItemTitle,MemberLogin,Permission";<p>ProgressReportLogging(header, logFilePath);<p>string sitrUrl = "<a href="https://share.ey.com/Sites/ClientPAS-Allianz">site-url</a>";<p>using (var ctx = GetClientContext(sitrUrl))<p>{<p>ctx.Load(ctx.Web, a => a.RoleAssignments.Include(roleAsg => roleAsg.Member.LoginName, roleAsg => roleAsg.Member.Title,<p>roleAsg => roleAsg.RoleDefinitionBindings.Include(roleDef => roleDef.Name,<p>roleDef => roleDef.Description)));<p>ctx.ExecuteQuery();<p>foreach (var roleAsg in ctx.Web.RoleAssignments)<p>{<p>List<string> roles = new List<string>();<p>foreach (var role in roleAsg.RoleDefinitionBindings)<p>{<p>roles.Add(role.Name);<p>}<p>Console.WriteLine("Permissions: " + string.Join("|", roles.ToArray()));<p>Console.WriteLine("----------------");<p>string msg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", sitrUrl, "", "", "Success", "web has unique permission",<p>"", "", roleAsg.Member.Title, string.Join("|", roles.ToArray()));<p>ProgressReportLogging(msg, logFilePath);<p>}<p>IEnumerable<List> lstCollection = ctx.LoadQuery(ctx.Web.Lists);<p>ctx.ExecuteQuery();<p>foreach (List list in lstCollection)<p>{<p>if (!list.Hidden)<p>{<p>try<p>{<p>ctx.Load(list, l => l.HasUniqueRoleAssignments);<p>var listItems = list.GetItems(CamlQuery.CreateAllItemsQuery());<p>ctx.Load(listItems, a => a.IncludeWithDefaultProperties(b => b.HasUniqueRoleAssignments),<p>permsn => permsn.Include(a => a.RoleAssignments.Include(roleAsg => roleAsg.Member.LoginName, roleAsg => roleAsg.Member.Title,<p>roleAsg => roleAsg.RoleDefinitionBindings.Include(roleDef => roleDef.Name,<p>roleDef => roleDef.Description))));<p>ctx.ExecuteQuery();<p>foreach (var item in listItems)<p>{<p>Console.WriteLine("List item: " + item["FileRef"].ToString());<p>if (item.HasUniqueRoleAssignments)<p>{<p>foreach (var roleAsg in item.RoleAssignments)<p>{<p>Console.WriteLine("User/Group: " + roleAsg.Member.LoginName);<p>List<string> roles = new List<string>();<p>foreach (var role in roleAsg.RoleDefinitionBindings)<p>{<p>roles.Add(role.Name);<p>}<p>Console.WriteLine("Permissions: " + string.Join("|", roles.ToArray()));<p>Console.WriteLine("----------------");<p>string msg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", sitrUrl, list.Title, list.HasUniqueRoleAssignments, "Success", "Item has unique permission",<p>item.Id, Convert.ToString(item["Title"]), roleAsg.Member.Title, string.Join("|", roles.ToArray()));<p>ProgressReportLogging(msg, logFilePath);<p>}<p>}<p>else<p>{<p>Console.WriteLine("No unique permission found");<p>string msg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", sitrUrl, list.Title, list.HasUniqueRoleAssignments, "Success", "Item has NO unique permission",<p>item.Id, Convert.ToString(item["Title"]), "N-A", "No unique permission found for the item");<p>ProgressReportLogging(msg, logFilePath);<p>}<p>}<p>}<p>catch (Exception ex)<p>{<p>string msg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", sitrUrl, "N-A", "N-A", "Error: processing the list", ex.Message, "N-A", "N-A", "N-A", "N-A");<p>LogErrorMessage(msg + ex.Message);<p>ProgressReportLogging(msg, logFilePath);<p>continue;<p>}<p>}<p>}<p>}<p>}</p></td></tr><tr><td width="561" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p></td></tr></tbody></table><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p><br></o:p></span></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><o:p></o:p></p></div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-53369135166968466402018-04-16T08:18:00.004-07:002018-09-17T13:07:31.222-07:00Rotate an image n number of times<meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.msonormal, li.msonormal, div.msonormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.msohyperlink
{mso-style-priority:99;
color:#0563c1;
text-decoration:underline;}
a:visited, span.msohyperlinkfollowed
{mso-style-priority:99;
color:#954f72;
text-decoration:underline;}
span.emailstyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.msochpdefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page wordsection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.wordsection1
{page:wordsection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div class="WordSection1"><table class="MsoTableGrid" style="border: currentcolor; border-image: none; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td width="471" valign="top" style="padding: 0in 5.4pt; border: 1pt solid windowtext; border-image: none; width: 467.5pt;"><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AnimateRotate(angle, repeat, elemn) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> duration = 1000;<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> setTimeout(</span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> () {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (repeat && repeat == </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"infinite"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AnimateRotate(angle, repeat, elemn);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> } </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">else</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">if</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (repeat && repeat > 1) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AnimateRotate(angle, repeat - 1, elemn);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }, duration)<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> $elem = elemn;<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> $({ deg: 0 }).animate({ deg: angle }, {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> duration: duration,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> step: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (now) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> $elem.css({<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'transform'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">: </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'rotate('</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> + now + </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'deg)'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> });<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> });<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">}<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: blue; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p></td></tr><tr><td width="471" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ShowRefreshError() {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> element = document.createElement(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'div'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> refresherror = </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'<div id="dialog" title="Refresh Failed.">'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> +<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">' If the problem persists, please contact the <a href="https://google.com/"> HelpDesk</a>'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> +<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">' <div align="center"> </br><input onclick="return SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, value);" type="button" value="OK" name="opret_ok"> </div> '</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> +<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'</div>'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">;<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> element.innerHTML = refresherror;<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> options = {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> html: element,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> title: </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'Refresh Failed.'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> allowMaximize: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> showClose: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> autoSize: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> };<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> SP.SOD.execute(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'sp.ui.dialog.js'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">, </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">'SP.UI.ModalDialog.showModalDialog'</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">, options);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">}<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: blue; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p></td></tr><tr><td width="471" valign="top" style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: currentcolor windowtext windowtext; padding: 0in 5.4pt; border-image: none; width: 467.5pt;"><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">RefreshLink = </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> () {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">var</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> elemn = $(</span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"a[title|='Refresh] > img"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> AnimateRotate(360, 2, elemn);<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> $.ajax({<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> cache: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">false</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> type: </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"GET"</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> url: </span><span style="color: rgb(163, 21, 21); font-family: consolas; font-size: 9.5pt;">"https://google.com?webAddress</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> crossDomain: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;">,<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> xhrFields: {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> withCredentials: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">true</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> },<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> success: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (data) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">else</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ShowRefreshError();<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> },<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> error: </span><span style="color: blue; font-family: consolas; font-size: 9.5pt;">function</span><span style="color: black; font-family: consolas; font-size: 9.5pt;"> (status, error) {<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> ShowRefreshError();<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> }<o:p></o:p></span></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"> });<o:p></o:p></span></p><p class="MsoNormal"><span style="color: black; font-family: consolas; font-size: 9.5pt;">};</span><o:p></o:p></p><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: blue; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p></td></tr></tbody></table><p class="MsoNormal" style="-ms-text-autospace:;"><span style="color: black; font-family: consolas; font-size: 9.5pt;"><o:p> </o:p></span></p><p class="MsoNormal"><o:p> </o:p></p></div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-73708378972314668762018-03-16T09:29:00.001-07:002018-03-16T09:29:28.435-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
I had a requirement to move root level site collection as a subsite, as everyone knows this can be done by using the Granular back up for the site, you need to take .cmp file,<br />
I tried to restore the site to a sub site, i was unable to import it as the site template for the destination site is not matching with the backup file which i took,<br />
i.e. The back up which i took is BLANKINTERNET#0 web template, and i created a blank site wanted to override this site, i.e. STS#1, then again i tried to create a publishing site as the source was the publishing site, again this did not work, becouse destination was CMSINTERENET#1 site,<br />
the best solution is to create site of source site, i wrote a power shell script to achieve this,<br />
<br />
<a name='more'></a><br />
<pre style="background-color: white; border-style: none; direction: ltr; font-family: "courier new", courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; width: 695.833px;"><span id="lnum1" style="color: #606060;">1:</span> # Get-SPWebTemplate</pre>
<div style="font-family: "courier new", courier, monospace; font-size: 10.6667px;">
</div>
<pre style="background-color: #f4f4f4; border-style: none; direction: ltr; font-family: "courier new", courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; width: 695.833px;"><span id="lnum2" style="color: #606060;"> 2:</span> #$template = Get-SPWebTemplate <span style="color: #006080;">"blankinternet#0"</span></pre>
<div style="font-family: "courier new", courier, monospace; font-size: 10.6667px;">
</div>
<pre style="background-color: white; border-style: none; direction: ltr; font-family: "courier new", courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; width: 695.833px;"><span id="lnum3" style="color: #606060;"> 3:</span> #New-SPWeb -Url <span style="color: #006080;">"http://dca-dev-230:6565/sites/guru/gwp/"</span> -Template $template </pre>
<pre style="background-color: white; border-style: none; direction: ltr; font-family: "courier new", courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; width: 695.833px;"></pre>
this is create a destination site which you want, <br />
then try to import your site, it works well ! <br />
after that I had a custom layout which is designed by SPD, as it was a root level collection, something goes wrong no pages which use the custom layout is not working, <br />
because publishing site is not recommended to import and export, Microsoft disables this for publishing site, but still we want to do sometimes. <img alt="Smile" class="wlEmoticon wlEmoticon-smile" src="https://lh6.ggpht.com/-2hf_zaYmWoM/UBAUestTx_I/AAAAAAAAGAs/3g0D5IFw4mc/wlEmoticon-smile2.png?imgmax=800" style="border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none;" /><br />
<br />
Steps to work your all layouts pages<br />
<br />
1) create a testing page and apply your layout to that page, download this file and check what is the proper name of the <publishinglayout> tag, <br />
<br />
<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; height: 86px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 119.27%;">
<br />
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum1" style="color: #606060;"> 1:</span> http://<site url>/sites/guru/_catalogs/masterpage/GWP_BlankWebPartPage.aspx, /sites/guru/_catalogs/masterpage/GWP_BlankWebPartPage.aspx</pre>
<!--CRLF--></div>
</div>
<br />
this you need to copy and run my below, script. <br />
boring to do for all the pages? <img alt="Sad smile" class="wlEmoticon wlEmoticon-sadsmile" src="https://lh5.ggpht.com/-HMsPG8pVEFs/UBAUfHhkUBI/AAAAAAAAGA0/ELaaxGQv8H8/wlEmoticon-sadsmile2.png?imgmax=800" style="border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none;" /> <br />
run below script <br />
<br />
<br />
<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; height: 210px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 125.37%;">
<br />
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">[System.Reflection.Assembly]::LoadWithPartialName(<span style="color: #006080;">"Microsoft.SharePoint"</span>)</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">[System.Reflection.Assembly]::LoadWithPartialName(<span style="color: #006080;">"Microsoft.SharePoint.Publishing"</span>)</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> </pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">$web = Get-SPWeb -Identity <span style="color: #006080;">"http://<site url>/sites/guru/gwp/"</span>;</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> </pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">$spPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web);</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">$pages = $spPubWeb.PagesList;</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> </pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span style="color: blue;">foreach</span>($item <span style="color: blue;">in</span> $pages.Items)</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">{</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage = [Microsoft.SharePoint.Publishing.PublishingPage]::GetPublishingPage($item)</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> </pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $url = <span style="color: blue;">new</span>-<span style="color: blue;">object</span> Microsoft.SharePoint.SPFieldUrlValue($pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout].ToString())</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> <span style="color: blue;">if</span>($url -ne $<span style="color: blue;">null</span>)</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> { </pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> <span style="color: blue;">if</span>($url.Url -match <span style="color: #006080;">'GWP_BlankWebPartPage'</span>) #layout name</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> { </pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $newurl = <span style="color: blue;">new</span>-<span style="color: blue;">object</span> Microsoft.SharePoint.SPFieldUrlValue(<span style="color: #006080;">"http:/<site url>/sites/guru/_catalogs/masterpage/GWP_BlankWebPartPage.aspx, /sites/guru/_catalogs/masterpage/GWP_BlankWebPartPage.aspx"</span>)</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage.Name</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage.CheckOut()</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout] = $newurl</pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage.ListItem.UpdateOverwriteVersion()</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> </pre>
<!--CRLF--><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> $pubPage.ListItem.File.CheckIn(<span style="color: #006080;">"Fixed URL to page layout."</span>, [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn);</pre>
<!--CRLF--><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: "courier new" , "courier" , monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"> }</pre>
<!--CRLF--></div>
</div>
<br />
<br />
<br />
<br />
<br /></div>
Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-37576346030455079062018-03-16T09:26:00.003-07:002018-03-16T09:26:38.779-07:00Fixing: The client and server cannot communicate, because they do not possess a common algorithm<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="background-color: white; color: #333333; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 14px;">A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The client and server cannot communicate, because they do not possess a common algorithm.) (Microsoft SQL Server, Error: -2146893007)"</span><br />
<span style="background-color: white; color: #333333; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 14px;"><br /></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;">run below PS in your server, I got it from somewhere from internet. which fixed my servers</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;">note: it will ask for restart.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;"></span></span><br />
<a name='more'></a><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Copyright 2016, Alexander Hass</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># http://www.hass.de/content/setup-your-iis-ssl-perfect-forward-secrecy-and-tls-12</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">#</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.7</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - Windows Version compare failed. Get-CimInstance requires Windows 2012 or later.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.6</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - OS version detection for cipher suites order.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.5</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - Enabled ECDH and more secure hash functions and reorderd cipher list.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - Added Client setting for all ciphers.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.4</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - RC4 has been disabled.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.3</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - MD5 has been disabled.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.2</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - Re-factored code style and output</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Version 1.1</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - SSLv3 has been disabled. (Poodle attack protection)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'Configuring IIS with SSL/TLS Deployment Best Practices...'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host '--------------------------------------------------------------------------------'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Disable Multi-Protocol Unified Hello</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'Multi-Protocol Unified Hello has been disabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Disable PCT 1.0</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'PCT 1.0 has been disabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Disable SSL 2.0 (PCI Compliance)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'SSL 2.0 has been disabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># NOTE: If you disable SSL 3.0 the you may lock out some people still using</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Windows XP with IE6/7. Without SSL 3.0 enabled, there is no protocol available</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># for these people to fall back. Safer shopping certifications may require that</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># you disable SSLv3.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">#</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Disable SSL 3.0 (PCI Compliance) and enable "Poodle" protection</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'SSL 3.0 has been disabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Add and Enable TLS 1.0 for client and server SCHANNEL communications</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'TLS 1.0 has been enabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Add and Enable TLS 1.1 for client and server SCHANNEL communications</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'TLS 1.1 has been enabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Add and Enable TLS 1.2 for client and server SCHANNEL communications</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' -name 'DisabledByDefault' -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'TLS 1.2 has been enabled.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Re-create the ciphers key.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Disable insecure/weak ciphers.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$insecureCiphers = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'DES 56/56',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'NULL',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC2 128/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC2 40/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC2 56/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC4 40/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC4 56/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC4 64/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'RC4 128/128'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Foreach ($insecureCipher in $insecureCiphers) {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key = (Get-Item HKLM:\).OpenSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers', $true).CreateSubKey($insecureCipher)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key.SetValue('Enabled', 0, 'DWord')</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key.close()</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host "Weak cipher $insecureCipher has been disabled."</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Enable new secure ciphers.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - RC4: It is recommended to disable RC4, but you may lock out WinXP/IE8 if you enforce this. This is a requirement for FIPS 140-2.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - 3DES: It is recommended to disable these in near future. This is the last cipher supported by Windows XP.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># - Windows Vista and before 'Triple DES 168' was named 'Triple DES 168/168' per https://support.microsoft.com/en-us/kb/245030</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$secureCiphers = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'AES 128/128',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'AES 256/256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'Triple DES 168'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Foreach ($secureCipher in $secureCiphers) {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key = (Get-Item HKLM:\).OpenSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers', $true).CreateSubKey($secureCipher)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> New-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\$secureCipher" -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key.close()</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host "Strong cipher $secureCipher has been enabled."</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Set hashes configuration.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\MD5' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\MD5' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$secureHashes = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'SHA512'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Foreach ($secureHash in $secureHashes) {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key = (Get-Item HKLM:\).OpenSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes', $true).CreateSubKey($secureHash)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> New-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\$secureHash" -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key.close()</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host "Hash $secureHash has been enabled."</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Set KeyExchangeAlgorithms configuration.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$secureKeyExchangeAlgorithms = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'Diffie-Hellman',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'ECDH',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'PKCS'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Foreach ($secureKeyExchangeAlgorithm in $secureKeyExchangeAlgorithms) {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key = (Get-Item HKLM:\).OpenSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms', $true).CreateSubKey($secureKeyExchangeAlgorithm)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> New-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\$secureKeyExchangeAlgorithm" -name 'Enabled' -value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $key.close()</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host "KeyExchangeAlgorithm $secureKeyExchangeAlgorithm has been enabled."</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># Set cipher suites order as secure as possible (Enables Perfect Forward Secrecy).</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$os = Get-WmiObject -class Win32_OperatingSystem</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">if ([System.Version]$os.Version -lt [System.Version]'10.0') {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host 'Use cipher suites order for Windows 2008/2008R2/2012/2012R2.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $cipherSuitesOrder = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P521',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_GCM_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_GCM_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> )</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">else {</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> Write-Host 'Use cipher suites order for Windows 10/2016 and later.'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> $cipherSuitesOrder = @(</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_GCM_SHA384',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_GCM_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_CBC_SHA256',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_256_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_AES_128_CBC_SHA',</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"> )</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">}</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">$cipherSuitesAsString = [string]::join(',', $cipherSuitesOrder)</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"># One user reported this key does not exists on Windows 2012R2. Cannot repro myself on a brand new Windows 2012R2 core machine. Adding this just to be save.</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-Item 'HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002' -ErrorAction SilentlyContinue</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">New-ItemProperty -path 'HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002' -name 'Functions' -value $cipherSuitesAsString -PropertyType 'String' -Force | Out-Null</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host '--------------------------------------------------------------------------------'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host 'NOTE: After the system has been rebooted you can verify your server'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host ' configuration at https://www.ssllabs.com/ssltest/'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host "--------------------------------------------------------------------------------`n"</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Write-Host -ForegroundColor Red 'A computer restart is required to apply settings. Restart computer now?'</span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 14px;"></span></span><br />
<span style="color: #333333; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 14px;">Restart-Computer -Force -Confirm</span></span></div>
Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-44298030053867063112018-02-09T12:41:00.000-08:002018-02-09T12:41:17.040-08:00Powershell to add dummy documents to SharePoint List for Testing purpose<div dir="ltr" style="text-align: left;" trbidi="on">
Write-Host "Loading SharePoint Powershell Snapin"<br />
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} <br />
if ($snapin -eq $null) { Add-PSSnapin "Microsoft.SharePoint.Powershell" }<br />
<br />
# ---- Script settings ----<br />
$sourceDocumentPath = "C:\temp\TestDoc.docx" # Source document to spawn new documents from for the creation<br />
$newFilenamePrefix = "TestDoc"<br />
$newFilenameExtension = ".docx"<br />
$numberDocsToCreate = 5000<br />
<br />
# Settings for the destination to create documents in<br />
<br />
$webUrl = "http://site:1111/sites/tdm3"<br />
$docLibraryName = "Lib"<br />
$folderPathWithinDocLibrary = "" # Leave empty e.g. "" to create documents in root folder of library otherwise specify path relative to root folder e.g. "/Testing/Folder A"<br />
<br />
# -------------------------<br />
<br />
#Open web and library<br />
$web = Get-SPWeb $webUrl<br />
$docLibrary = $web.Lists[$docLibraryName]<br />
$docLibraryUrl = $docLibrary.RootFolder.ServerRelativeUrl<br />
$uploadfolder = $web.getfolder($docLibraryUrl + $folderPathWithinDocLibrary)<br />
<br />
#Open file<br />
$file = get-item $sourceDocumentPath<br />
$fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()<br />
<br />
# Create documents in SharePoint<br />
write-host "Creating $i documents based on the file $sourceDocumentPath"<br />
<br />
for($i=1; $i -le $numberDocsToCreate; $i++)<br />
{<br />
$newFilePath = $docLibraryUrl + $folderPathWithinDocLibrary + "/" + $newFilenamePrefix+$i+$newFilenameExtension<br />
write-host "Creating document: $newFilePath ..."<br />
$spFile = $uploadfolder.Files.Add($newFilePath, [System.IO.Stream]$fileStream, $true)<br />
}<br />
<br />
write-host "Completed"<br />
<br />
#Close file stream<br />
$fileStream.Close()<br />
<br />
#Dispose web<br />
$web.Dispose()</div>
Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-8647648231587357222018-02-09T12:38:00.000-08:002018-02-09T12:38:10.533-08:00Schedule Nintex Workflows to ListItems via Nintex web service<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Small Utility to Schedule Nintex Workflows to SharePoint ListItems via Nintex web service<br />
<br />
internal class Program<br />
{<br />
private static void Main(string[] args)<br />
{<br />
var sourceListName = "EIQ"; //<br />
var siteUrl = "http://site:3333";<br />
var UserName = "dtu";<br />
var pwd = "Password10";<br />
var domain = "dev";<br />
string env = "DEV";<br />
string workflowName = "IncompleteForm_WF";<br />
try<br />
{<br />
ClientContext clientContext = null;<br />
if (env.ToUpper() == "DEV")<br />
{<br />
clientContext = Auth(siteUrl, UserName, pwd, domain);<br />
}<br />
else if (env.ToUpper() == "UAT")<br />
{<br />
clientContext = MixedAuthRequest(siteUrl, UserName, pwd, domain);<br />
}<br />
<br />
NintexWorkflowWSSoapClient soapClient = InitializeNintexSoapClienn(UserName, pwd, domain);<br />
Microsoft.SharePoint.Client.User spUser;<br />
spUser = clientContext.Web.CurrentUser;<br />
Console.WriteLine("Loading User!");<br />
clientContext.Load(spUser, user => user.LoginName);<br />
Console.WriteLine("Loading Login Name");<br />
clientContext.ExecuteQuery();<br />
Console.WriteLine(spUser.LoginName);<br />
//Process EID list items<br />
ProcessEIQItems(clientContext, sourceListName, soapClient, workflowName);<br />
Console.ReadLine();<br />
}<br />
catch (Exception ex)<br />
{<br />
<br />
string message = "Error in main method";<br />
Console.WriteLine(message);<br />
ErrorLogging(ex, message);<br />
Console.ReadLine();<br />
}<br />
}<br />
<br />
private static NintexWorkflowWSSoapClient InitializeNintexSoapClienn(string UserName, string pwd, string domain)<br />
{<br />
try<br />
{<br />
var soapClient = new NintexWorkflowWSSoapClient("NintexWorkflowWSSoap");<br />
//need to name the endpoint being used.<br />
soapClient.ClientCredentials.Windows.ClientCredential.UserName = UserName;<br />
soapClient.ClientCredentials.Windows.ClientCredential.Password = pwd;<br />
soapClient.ClientCredentials.Windows.ClientCredential.Domain = domain; //optional<br />
//soapClient.ClientCredentials.Windows.AllowNtlm = true; //optional<br />
soapClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; //optional<br />
return soapClient;<br />
}<br />
catch (Exception ex)<br />
{<br />
string message = "Error in Initialising the Nintexwebservice soap method";<br />
Console.WriteLine(message);<br />
ErrorLogging(ex, message);<br />
throw ex;<br />
}<br />
}<br />
<br />
private static void ProcessEIQItems(ClientContext clientContext, string listName, NintexWorkflowWSSoapClient soapClient, string workflowName)<br />
{<br />
ListItemCollection olistItems = null; <br />
try<br />
{<br />
Microsoft.SharePoint.Client.List oList = clientContext.Web.Lists.GetByTitle(listName);<br />
CamlQuery query = new CamlQuery();<br />
query.ViewXml = string.Format("<view><query><where><and><eq><fieldref name="IsComplete"><value type="Boolean">true</value></fieldref></eq><geq>" +</geq></and></where></query></view><br />
"<fieldref name="NextReminderDate"><value includetimevalue="FALSE" type="DateTime"><today></today></value></fieldref></div>
");<br />
olistItems = oList.GetItems(query);<br />
clientContext.Load(olistItems);<br />
clientContext.ExecuteQuery();<br />
if (olistItems != null && olistItems.Count > 0)<br />
{<br />
foreach (ListItem listItem in olistItems)<br />
{<br />
var strDate = Convert.ToDateTime(listItem["NextReminderDate"].ToString());<br />
if (strDate != null)<br />
{<br />
ScheduleNintexWrorkflow(listName, soapClient, workflowName, listItem, strDate);<br />
}<br />
}<br />
<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
string message = "Error in ProcessEIQItems method";<br />
Console.WriteLine(message);<br />
ErrorLogging(ex, message);<br />
throw ex;<br />
}<br />
}<br />
<br />
private static void ScheduleNintexWrorkflow(string listName, NintexWorkflowWSSoapClient soapClient, string workflowName, ListItem listItem, DateTime strDate)<br />
{<br />
try<br />
{ <br />
Schedule sc = new Schedule();<br />
sc.StartTime = strDate;<br />
RepeatInterval ri = new RepeatInterval();<br />
ri.CountBetweenIntervals = 14;<br />
ri.Type = RepeatIntervalType.Hourly;<br />
sc.RepeatInterval = ri;<br />
sc.MaximumRepeats = 0;<br />
sc.WorkdaysOnly = false;<br />
sc.EndOn = EndScheduleOn.RepeatCount;<br />
var ret = soapClient.AddWorkflowScheduleOnListItem(Convert.ToInt32(listItem["ID"]), listName, workflowName, "", sc, true);<br />
}<br />
catch (Exception ex)<br />
{<br />
string message = "Error in Scheduling the item ID: " + Convert.ToString(listItem["ID"]);<br />
Console.WriteLine(message);<br />
ErrorLogging(ex, message);<br />
}<br />
}<br />
<br />
public static void ErrorLogging(Exception ex, string message)<br />
{<br />
string strPath = @"D:\NintexScheuldeWFLog.txt";<br />
if (!System.IO.File.Exists(strPath))<br />
{<br />
System.IO.File.Create(strPath).Dispose();<br />
}<br />
using (StreamWriter sw = System.IO.File.AppendText(strPath))<br />
{<br />
sw.WriteLine(message + ",Error Message: " + ex.Message);<br />
}<br />
}<br />
<br />
private static ClientContext MixedAuthRequest(string siteUrl, string userName, string pwd, string domain)<br />
{<br />
ClientContext returnContext = null;<br />
ClientContext spClientContext = null;<br />
<br />
int retryCount = 5; // Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["retryCount"]); <br />
<br />
for (int i = 0; i <= retryCount; i++)<br />
{<br />
try<br />
{<br />
using (spClientContext = new ClientContext(siteUrl))<br />
{<br />
<br />
spClientContext.ExecutingWebRequest += new EventHandler<webrequesteventargs>(Ctx_MixedAuthRequest);</webrequesteventargs><br />
spClientContext.AuthenticationMode = ClientAuthenticationMode.Default;<br />
<br />
<br />
<br />
<br />
spClientContext.Credentials = new NetworkCredential(userName, pwd, domain);<br />
returnContext = spClientContext;<br />
<br />
break;<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
if (i == retryCount)<br />
{<br />
Console.WriteLine("Falied Mixed Auth Context: " + ex.Message);<br />
throw;<br />
}<br />
}<br />
}<br />
return returnContext;<br />
}<br />
<br />
private static void Ctx_MixedAuthRequest(object sender, WebRequestEventArgs e)<br />
{<br />
//Add the header that tells SharePoint to use Windows authentication.<br />
e.WebRequestExecutor.RequestHeaders.Add(<br />
"X-FORMS_BASED_AUTH_ACCEPTED", "f");<br />
}<br />
<br />
public static ClientContext Auth(string siteURL, string username, string password, string domain)<br />
{<br />
ClientContext context = new ClientContext(siteURL);<br />
Web web = context.Web;<br />
<br />
<br />
// for network credentials<br />
NetworkCredential _myCredentials = new NetworkCredential(username, password, domain);<br />
context.AuthenticationMode = ClientAuthenticationMode.Default;<br />
context.Credentials = _myCredentials;<br />
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .NET 4.0<br />
<br />
//context.Credentials = new SharePointOnlineCredentials(spoUserName, pwd);<br />
try<br />
{<br />
context.Load(web);<br />
context.ExecuteQuery();<br />
Console.WriteLine("Authentication Succesful for " + web.Title + " site");<br />
return context;<br />
}<br />
catch (Exception e)<br />
{<br />
Console.WriteLine("Authentication failed.");<br />
return null;<br />
}<br />
}<br />
<br />
}Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-81786341679119497092018-02-09T12:33:00.002-08:002018-09-14T13:08:38.876-07:00Get All List Items from SharePoint List page wise to handle threshold limit<div style="text-align: left;" dir="ltr" trbidi="on">
<div class="MsoNormal">
<span style="font-family: "candara" , sans-serif; font-size: 13.5pt;"><br>
Below is the common error during development:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "candara" , sans-serif; font-size: 13.5pt;">The attempted operation is prohibited because it exceeds the list
view threshold enforced by the administrator. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "candara" , sans-serif; font-size: 13.5pt;">How to handle in client object model?<o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: "candara" , sans-serif; font-size: 12pt;">To avoid threshold error, we can
use below orderby query.<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="color: maroon; font-family: "consolas"; font-size: 9.5pt;">OrderBy Override='TRUE'><fieldref name="ID"></fieldref></span></div>
<span style="font-family: "times new roman" , serif; font-size: 13.5pt;"><o:p></o:p></span><br>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: "candara" , sans-serif; font-size: 12pt;">Using Sorting on the returned list<o:p></o:p></span></li>
</ul>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;">items = items.OrderBy(item => item.FieldValues[</span><span style="color: rgb(163, 21, 21); font-family: "consolas"; font-size: 9.5pt;">"FileLeafRef"</span><span style="font-family: "consolas"; font-size: 9.5pt;">]).ToList();</span><span style="font-family: "times new roman" , serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: "candara" , sans-serif; font-size: 12pt;">Implementing the search on the
items. Sample below which brings matched document string name on the page</span><span style="font-family: "times new roman" , serif; font-size: 12pt;"><o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "consolas"; font-size: 9.5pt;">items = items.FindAll(f => f.FieldValues[</span><span style="color: rgb(163, 21, 21); font-family: "consolas"; font-size: 9.5pt;">"FileLeafRef"</span><span style="font-family: "consolas"; font-size: 9.5pt;">].ToString().ToLower().Contains(</span><span style="color: rgb(163, 21, 21); font-family: "consolas"; font-size: 9.5pt;">"<doc name="" variable="">"</doc></span><span style="font-family: "consolas"; font-size: 9.5pt;">.ToLower())).ToList();</span><span style="font-family: "times new roman" , serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal"><br></div>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: "candara" , sans-serif; font-size: 12pt;"> Complete
Method</span></li><li class="MsoNormal"><span style="font-family: "candara" , sans-serif; font-size: 12pt;"></span><span style="font-family: "times new roman" , serif; font-size: 13.5pt;"><o:p></o:p></span></li>
</ul>
<div class="MsoNormal">
<div class="MsoNormal" style="margin-left: 0.25in;">
<div class="separator" style="text-align: center; clear: both;">
<a style="margin-right: 1em; margin-left: 1em;" href="https://2.bp.blogspot.com/-7M7SQX238Bw/WqvzTfkgJTI/AAAAAAAAlgE/6vHpgiNfMlA5ylOG2pVSoYgC-Z9hI0DvwCLcBGAs/s1600/2018-03-16_12-38-43.png" imageanchor="1"><img width="400" height="330" src="https://2.bp.blogspot.com/-7M7SQX238Bw/WqvzTfkgJTI/AAAAAAAAlgE/6vHpgiNfMlA5ylOG2pVSoYgC-Z9hI0DvwCLcBGAs/s400/2018-03-16_12-38-43.png" border="0" data-original-height="800" data-original-width="965"></a></div><div class="separator" style="text-align: center; clear: both;"><br></div><p>public static List<ListItem> GetAllListItemsInaList1(ClientContext ctx, string siteurl)<p> {<p>List<ListItem> items = new List<ListItem>();<p> ctx.Load(ctx.Web, a => a.Lists);<p> ctx.ExecuteQuery();<p>List list = ctx.Web.Lists.GetByTitle("EngagementDocumentLibrary");<p>ListItemCollectionPosition position = null;<p>int rowLimit = 4999;<p>var camlQuery = new CamlQuery();<p> camlQuery.ViewXml = @"<View Scope='RecursiveAll'><p> <Query><p><OrderBy Override='TRUE'><FieldRef Name='ID'/></OrderBy> <p> </Query><p> <ViewFields><p> <FieldRef Name='FileLeafRef'/><FieldRef Name='File_x0020_Type' /><FieldRef Name='FileRef' /><FieldRef Name='Editor' /><p> </ViewFields><p> <RowLimit Paged='TRUE'>" + rowLimit + "</RowLimit></View>";<p>do<p> {<p>ListItemCollection listItems = null;<p> camlQuery.ListItemCollectionPosition = position;<p> listItems = list.GetItems(camlQuery);<p> ctx.Load(listItems);<p> ctx.ExecuteQuery();<p> position = listItems.ListItemCollectionPosition;<p> items.AddRange(listItems.ToList());<p> }<p>while (position != null);<p> items = items.OrderBy(item => item.FieldValues["FileLeafRef"]).ToList();<p>return items;<p> }</p>
<div class="MsoNormal" style="margin-left: 0.25in;"><br></div>
</div>
</div>
</div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-70241778734830678662018-02-09T12:24:00.002-08:002018-02-09T12:24:47.919-08:00Check if SharePoint Group Exists Client Object Model<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Check if SharePoint Group Exists Client Object Model<br />
<br />
<div class="MsoNormal">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">Web</span><span style="font-family: Consolas; font-size: 9.5pt;"> web = clientContext.Site.RootWeb;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">clientContext.ExecuteQuery(); <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">var</span><span style="font-family: Consolas; font-size: 9.5pt;"> currentGroups = web.SiteGroups;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">clientContext.Load(currentGroups);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">clientContext.ExecuteQuery();</span><o:p></o:p></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">bool</span><span style="font-family: Consolas; font-size: 9.5pt;"> isGroupExists = </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">false</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (currentGroups.Count > 0)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<span style="font-family: Consolas; font-size: 9.5pt;">isGroupExists =
currentGroups.OfType<microsoft .sharepoint.client.="" span=""><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">Group</span><span style="font-family: Consolas; font-size: 9.5pt;">>().Count(g => g.Title.Equals(“Pass
your groupname”, </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">StringComparison</span><span style="font-family: Consolas; font-size: 9.5pt;">.InvariantCultureIgnoreCase)) > 0;<o:p></o:p></span></microsoft></span></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">}</span><o:p></o:p></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal">
<br /></div>
</div>
Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-3777428522510654242015-09-08T09:09:00.001-07:002015-09-08T09:09:08.462-07:00SMTP Timeout error–Resolution.<p> </p> <p>at System.Net.Mail.SmtpClient.Send(MailMessage message)</p> <p> </p> <p>public static bool SendLongProcessEmail(string smtpserver, MailMessage newEmail, SmtpClient client)<br> {<br> Log logmsg = new Log();<br> bool mailSent = false;<br> try<br> {<br> <br> try<br> {</p> <p> client.Host = smtpserver;<br> client.ServicePoint.MaxIdleTime = 0;<br> client.ServicePoint.ConnectionLimit = 1;<br> client.Timeout = 10000000;<br> client.Send(newEmail);<br> mailSent = true;</p> <p> }<br> catch (Exception)<br> {<br> client.Send(newEmail);<br> mailSent = true;<br> }<br> }<br> catch (Exception ex)<br> {<br> logmsg.HandleException(ex.StackTrace, ex.Message, "SendLongProcessEmail Method");<br> return false;<br> }<br> return mailSent;<br> }<br></p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6a1f0a39-a905-47f9-bc73-f9882f5ad50c" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Technorati Tags: <a href="http://technorati.com/tags/SMTP" rel="tag">SMTP</a>,<a href="http://technorati.com/tags/timeout" rel="tag">timeout</a>,<a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/email" rel="tag">email</a>,<a href="http://technorati.com/tags/send" rel="tag">send</a></div> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-8289444446671824412015-08-29T19:09:00.001-07:002018-04-19T08:44:50.168-07:00Sending email from PowerShell<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote>
</blockquote>
<br />
Send-MailMessage –From <a href="mailto:Guruprasad_Marathe@aaa.com">Guruprasad_Marathe@aaa.com</a> –To <a href="mailto:Guruprasad_Marathe@aaa.com">Guruprasad_Marathe@aaa.com</a> –Subject “Test Email” –Body “Test E-mail (body)” -SmtpServer mailserver.aaa.com <br />
<br />
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1ec61da4-60b8-47f7-a4f0-1e6862fddff9" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Technorati Tags: <a href="http://technorati.com/tags/Powershell" rel="tag">Powershell</a>,<a href="http://technorati.com/tags/send+email" rel="tag">send email</a>,<a href="http://technorati.com/tags/SMPT" rel="tag">SMPT</a></div>
</div>
Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-26451779759950457622015-08-29T19:07:00.001-07:002015-08-29T19:07:02.061-07:00PowerShell to unlock the files which are locked from SharePoint<p> </p> <p> </p> <p>$web = Get-SPWeb <a href="http://<site>/Ringo">http://<site>/Ringo</a> <p>$list = $web.Lists["Shared Documents"] <p>$item = $list.GetItemById(171) <p>$file = $item.File <p>$file <p>$userId = $file.LockedByUser.ID <p>$user = $web.AllUsers.GetByID($userId) <p>$impSite= New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken); <p>$impWeb = $impSite.OpenWeb(); <p>$impList = $impWeb.Lists[$list.Title] <p>$impItem = $impList.GetItemById($item.ID) <p>$impFile = $impItem.File <p>$impFile.ReleaseLock($impFile.LockId) <p> </p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e5015968-3391-488d-862e-0bea06acc5a5" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/unlock+file" rel="tag">unlock file</a>,<a href="http://technorati.com/tags/powershell" rel="tag">powershell</a>,<a href="http://technorati.com/tags/shortterm+lock" rel="tag">shortterm lock</a>,<a href="http://technorati.com/tags/long+term+lock" rel="tag">long term lock</a>,<a href="http://technorati.com/tags/SharePoint+2010" rel="tag">SharePoint 2010</a>,<a href="http://technorati.com/tags/SharePoint+2013" rel="tag">SharePoint 2013</a></div> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-33252793264498942682014-05-06T00:24:00.001-07:002014-05-06T00:24:17.997-07:00Discovering or Reports on the items permissions for SharePoint Library or List PowerShell script<p> </p><pre class="csharpcode">Clear-Host<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:91bf6faf-a2ed-4721-908f-af090962aa72" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Sharepoint" rel="tag">Sharepoint</a>,<a href="http://technorati.com/tags/powershell" rel="tag">powershell</a>,<a href="http://technorati.com/tags/item+level+permission" rel="tag">item level permission</a>,<a href="http://technorati.com/tags/get+permission" rel="tag">get permission</a>,<a href="http://technorati.com/tags/report" rel="tag">report</a></div><br /><br /><span class="kwrd">if</span>((Get-PSSnapin | <span class="kwrd">where</span>{$_.Name -eq <span class="str">"Microsoft.SharePoint.PowerShell"</span>}) -eq $<span class="kwrd">null</span>)<br />{<br /> Add-PSSnapin Microsoft.SharePoint.PowerShell;<br /> Write-Host <span class="str">"Snap In Added"</span>;<br />}<br />$SiteUrl = <span class="str">"<site url>/sites/ags/spg/pit/pitsite"</span>;<br /><br />Function GetFiles($folder)<br />{ <br /> # Use recursion to loop through all subfolders.<br /> <span class="kwrd">foreach</span> ($spFolder <span class="kwrd">in</span> $folder.SubFolders)<br /> {<br /> <br /> <span class="kwrd">if</span>($spFolder.Name -ne <span class="str">'Forms'</span>)<br /> {<br /> <span class="kwrd">if</span>($spFolder.Item.HasUniqueRoleAssignments)<br /> { <br /> $roleAssignments = $spFolder.Item.RoleAssignments;<br /> <span class="kwrd">if</span> ($roleAssignments.Count -gt 0) {<br /> <span class="kwrd">foreach</span> ($role <span class="kwrd">in</span> $roleAssignments){<br /> $eachRole = $role.Member.ToString();<br /> $allRoles += $eachRole + <span class="str">";"</span>; <br /> }<br /> $url=$SiteUrl+<span class="str">"/"</span>+$spFolder.Url<br /> #$link = <span class="str">"<a href="</span> + $url + <span class="str">">"</span> +$url + <span class="str">"</a>"</span>;<br /> $OutInfo = $spFolder.Name + <span class="str">","</span> + $url + <span class="str">","</span> + <span class="str">"No"</span> + <span class="str">","</span> + $allRoles;<br /> Add-Content -Value $OutInfo -Path $OutFile<br /> <br /> }<br /> }<br /> <span class="kwrd">else</span><br /> {<br /> $url=$SiteUrl+<span class="str">"/"</span>+$spFolder.Url<br /> $OutInfo = $spFolder.Name + <span class="str">","</span> + $url + <span class="str">","</span> + <span class="str">"Yes"</span> + <span class="str">","</span> + <span class="str">""</span>;<br /> Add-Content -Value $OutInfo -Path $OutFile<br /> }<br /> }<br /> GetFiles($spFolder)<br /> }<br /> }</pre><pre class="csharpcode"> </pre><pre class="csharpcode">$OutFile = <span class="str">"D:\test\Permissions.csv"</span><br />$Header = <span class="str">"Folder Name,Folder URL,IsInherited,Permissions"</span><br />Del $OutFile<br /><br />Add-Content -Value $Header -Path $OutFile<br /><br /><br /><br />$web = Get-SPWeb -Identity <span class="str">"<site url>sites/ags/spg/pit/pitsite"</span><br /><br />$list = $web.GetList(<span class="str">"<siteurl>/sites/ags/spg/pit/pitsite/Shared Documents"</span>)<br /><br />GetFiles($list.RootFolder)</pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com1tag:blogger.com,1999:blog-2548722450033603623.post-82511771486874098852013-12-02T03:05:00.001-08:002013-12-02T03:05:29.584-08:00Parent & Child items in SharePoint 2010 OOTB through SPD<p>Requirement.</p> <p>many times we get requirement to create child items for the mail parent list item, for example. you have issues [Parent list] and you want to logs to those issues [Child list]</p> <p>This blog is for one of the person who took my interview [MindTree Ltd] and by my answers he was surprised and could not able to believe my solution. I told it is possible through OOTB with nice UI but he was confused and could not able to believe.</p> <p>he estimated it may take 2 to 3 weeks to do it. but I achieved within 6 hours. </p> <p>I will put snap shots first and the code how I did. </p> <p>Create Parent Item: [ note: I m not hiding SP default buttons so that people don’t confuse how I did it]</p> <p>in parent list I have just Title, I have provided Save and continue button, until we create parent. we cannot create child <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh4.ggpht.com/-CqjYWKAG6AY/UpxpUuR5oKI/AAAAAAAAKBE/bine6m6KdQk/wlEmoticon-smile%25255B2%25255D.png?imgmax=800"></p> <blockquote> <p><a href="http://lh5.ggpht.com/-UKoE7VQ99Y0/UpxpVSSL_TI/AAAAAAAAKBM/GiksYG3NiF0/s1600-h/image%25255B31%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-Qw3xPn_-P3c/UpxpWL4YNCI/AAAAAAAAKBU/WnGxumn0uh0/image_thumb%25255B16%25255D.png?imgmax=800" width="468" height="106"></a></p><pre style="width: 450px; height: 73px" class="csharpcode"><input type=<span class="str">"button"</span> <span class="kwrd">value</span>=<span class="str">"Save and Continue"</span> name=<span class="str">"btnSave"</span> <span class="kwrd">class</span>=<span class="str">"ms-ButtonHeightWidth"</span>/><br /></pre><br /><p> </p><pre style="width: 464px; height: 546px" class="csharpcode"><p>$(document).ready(function() {<br /> $(<span class="str">'input[name="btnSave"]'</span>).click(function(){CreateNewItem();});<br />});<br /><br />function CreateNewItem()<br />{<br /> debugger;<br /> var tit = $(<span class="str">'input[title="Title"]'</span>).val(); <br /> <br /> $().SPServices({<br /> operation: <span class="str">"UpdateListItems"</span>,<br /> async: <span class="kwrd">false</span>,<br /> batchCmd: <span class="str">"New"</span>,<br /> listName: <span class="str">"Parent List"</span>, <br /> valuepairs: [[<span class="str">"Title"</span>, tit]],<br /> completefunc: function (xData, Status) { <br /><br /> var newID = $(xData.responseXML).find(<span class="str">"z\\:row"</span>).attr(<span class="str">"ows_ID"</span>); <br /> <span class="kwrd">if</span>(newID == <span class="kwrd">null</span> || newID*1<1)<br /> {<br /> alert(<span class="str">"\nThere was an error in creating item."</span>);<br /> <span class="kwrd">return</span>; <br /> } <br /> <span class="kwrd">else</span> <br /> {<br /> window.location = <span class="str">"editparent.aspx?ID="</span>+newID;<br /> } <br /> }<br />});<br /><br />}<br /></script></p><p> </p><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style></pre></blockquote><br /><p>after saving the parent I am shifting the page from new form to edit form of same item, parents save and cancel button I am not hiding.]</p><br /><p><a href="http://lh3.ggpht.com/-oiVZSclowL0/UpxpWx3vk_I/AAAAAAAAKBc/NrzmpSOAgKg/s1600-h/image%25255B32%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-hifziCWNjU0/UpxpXuu4LLI/AAAAAAAAKBk/zVjDtMoPjKE/image_thumb%25255B17%25255D.png?imgmax=800" width="510" height="158"></a></p><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><blockquote><br /><p> </p><br /><p>note: I have added 2 save function, two way you can save the item</p><pre style="width: 452px; height: 194px" class="csharpcode">function Save()<br />{<br />debugger;<br /> saveStatus=<span class="kwrd">true</span>;<br /> preSaveStatus=<span class="kwrd">true</span>;<br /> <br /> var buttonName = $(<span class="str">"input[id$='diidIOSaveItem']"</span>)[0].name; <br /> <span class="kwrd">if</span> (!PreSaveItem())<br /> <span class="kwrd">return</span> <span class="kwrd">false</span>;<br /> WebForm_DoPostBackWithOptions(<span class="kwrd">new</span> WebForm_PostBackOptions(buttonName, <span class="str">""</span>, <span class="kwrd">true</span>, <span class="str">""</span>, <span class="str">""</span>, <span class="kwrd">false</span>, <span class="kwrd">true</span>));<br />}<br /></pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><p>I have added a button called create child entry. which pop ups child’s newform and after saving that item come below the edit form of parent. below create child button I have list view there I filter with parent ID ie id of the parent I am storing it in every child, I am sending this parent ID through query string</p><br /><p><a title="http://dca-dev-243:8885/sites/PST/Guru%20RnD/Lists/Child%20List/newChild.aspx?ParentQSID=22&IsDlg=1" href="http://<server>/sites/PST/Guru%20RnD/Lists/Child%20List/newChild.aspx?ParentQSID=22&IsDlg=1">http://<server>/sites/PST/Guru%20RnD/Lists/Child%20List/newChild.aspx?<font style="background-color: #ffff00">ParentQSID=22</font>&IsDlg=1</a></p></blockquote><br /><p><a href="http://lh5.ggpht.com/-ALdI_hZsSrc/UpxpYX9b5uI/AAAAAAAAKBs/sR5VpK2-DeI/s1600-h/image%25255B15%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-F1II9R75Q-8/UpxpZB85NRI/AAAAAAAAKB0/d8JI65ZPgHQ/image_thumb%25255B9%25255D.png?imgmax=800" width="508" height="302"></a></p><br /><p>once you save I have refresh the parent page so this item get filtered in the below list view</p><br /><p><a href="http://lh6.ggpht.com/-fxicdnTigRA/UpxpZyGWzTI/AAAAAAAAKB8/hRmiOEnot2I/s1600-h/image%25255B33%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-EyzwPVnbKsE/UpxpagB9P3I/AAAAAAAAKCE/vbKv5ampkdo/image_thumb%25255B18%25255D.png?imgmax=800" width="507" height="125"></a></p><br /><p> </p><pre style="width: 487px; height: 52px" class="csharpcode"> <input type=<span class="str">"button"</span> <span class="kwrd">class</span>=<span class="str">"ms-ButtonHeightWidth"</span> <span class="kwrd">value</span>=<span class="str">"Create a new Child Entry..."</span> onclick=<span class="str">"CreateChild();"</span>/><br /></pre><br /><p>this code in parent edit form.</p><pre class="csharpcode">function CreateChild()<br />{<br />var parentID = getParameterByName(<span class="str">"ID"</span>);<br /><span class="rem">//Using a generic object.</span><br />var options = {<br /> title: <span class="str">"My Dialog Title"</span>,<br /> width: 800,<br /> height: 600,<br /> url: <span class="str">"../../Lists/Child%20List/newChild.aspx?ParentQSID="</span>+parentID,<br /> dialogReturnValueCallback: function(dialogResult) <br /> { <br /> SP.UI.ModalDialog.RefreshPage(dialogResult) <br /> }<br /> };<br /> <br /><br />SP.UI.ModalDialog.showModalDialog(options);<br /><br />}<br /></pre><br /><p>CHILD NEW FORM</p><br /><p>I am setting parent id in child through SPD designer </p><pre class="csharpcode"><asp:Textbox runat=<span class="str">"server"</span> id=<span class="str">"ff2{$Pos}"</span> text=<span class="str">"{$varParentID}"</span> ControlMode=<span class="str">"New"</span> FieldName=<span class="str">"ParentID"</span> __designer:bind=<span class="str">"{ddwrt:DataBind('i',concat('ff2',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ParentID')}"</span>/> </pre><br /><p><a href="http://lh3.ggpht.com/-SUVYBwSDT80/UpxpbQOVukI/AAAAAAAAKCM/7vhkBWbOuJE/s1600-h/image%25255B26%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-q0Jc1dIbtTc/UpxpcPa8BZI/AAAAAAAAKCU/iTUyLuio-vA/image_thumb%25255B14%25255D.png?imgmax=800" width="305" height="208"></a></p><br /><p><a href="http://lh4.ggpht.com/-3VHnntRyXp4/UpxpdIVXgeI/AAAAAAAAKCc/tAznqtR-hzM/s1600-h/image%25255B30%25255D.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-guF9Rd-ygXc/Upxpd4vuehI/AAAAAAAAKCk/45w6qvsgASE/image_thumb%25255B15%25255D.png?imgmax=800" width="508" height="302"></a></p><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><p> </p><br /><div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b6529aad-6859-4bc3-8f04-e6dee6cb627d" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/parent+and+child" rel="tag">parent and child</a>,<a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/OOTb" rel="tag">OOTb</a>,<a href="http://technorati.com/tags/desinger" rel="tag">desinger</a></div> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-89463946361503241442013-11-05T21:53:00.001-08:002013-11-05T21:53:55.325-08:00Attachment & files [pdf, zip] are not prompting to Open in SharePoint 2010, only saved, not opening OR [file does not show open]<p><font size="4" face="Segoe UI Light">one of my customer raised a issue regarding file does not prompt to open the files in SharePoint site, mostly pdf and zip files</font></p> <p><a href="http://lh3.ggpht.com/-D-_VkiWNC_8/UnnZY7lW_oI/AAAAAAAAJ8w/InL4AoBJyeY/s1600-h/image%25255B4%25255D.png"><font size="4" face="Segoe UI Light"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-_M3WDACBx8o/UnnZZhopqTI/AAAAAAAAJ84/VQqxgg1THLU/image_thumb%25255B2%25255D.png?imgmax=800" width="438" height="222"></font></a></p> <p><font size="4" face="Segoe UI Light">yes it is a issue, if files does not opens why to maintain database. !!</font></p> <h5><font size="4" face="Segoe UI Light">The Solution</font></h5> <p><font size="4" face="Segoe UI Light">It is a simple web application setting ,The setting is called Browser File Handling and can be found in the General Settings of the web application.</font> <p><font face="Segoe UI Light"><font size="4">CA> webapplication> general settings> Browser file handling > make it to <strong>Permissive</strong></font></font> <p><a href="http://lh5.ggpht.com/-ZtheDNnjRng/UnnZaJqbyPI/AAAAAAAAJ9A/5MPLEb0B7mA/s1600-h/image%25255B8%25255D.png"><font size="4" face="Segoe UI Light"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-jvGyxZc4bFA/UnnZa8cipUI/AAAAAAAAJ9I/mNPDBqH-lbE/image_thumb%25255B4%25255D.png?imgmax=800" width="254" height="337"></font></a> <p><font size="4" face="Segoe UI Light">problem solved !! if you read a blog don’t forget to comment plzz</font> <p><a href="http://lh6.ggpht.com/-baSEzriSroE/UnnZbli2yQI/AAAAAAAAJ9Q/24F0lhYyZCM/s1600-h/image%25255B12%25255D.png"><font size="4" face="Segoe UI Light"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-zo_DzkcJjUs/UnnZcTGXh3I/AAAAAAAAJ9Y/wD-fNteNQrA/image_thumb%25255B6%25255D.png?imgmax=800" width="414" height="252"></font></a></p> <p><font size="4" face="Segoe UI Light"></font></p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f45cbec7-d928-45d9-8238-4e404774b3c2" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/not+open" rel="tag">not open</a>,<a href="http://technorati.com/tags/only+save" rel="tag">only save</a>,<a href="http://technorati.com/tags/not+prompting+to+open" rel="tag">not prompting to open</a>,<a href="http://technorati.com/tags/attchement+does+not+open" rel="tag">attchement does not open</a>,<a href="http://technorati.com/tags/pdf+zip+dont+open" rel="tag">pdf zip dont open</a></div> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-16919421780114213842013-10-14T05:35:00.001-07:002013-10-14T05:35:41.207-07:00Showing different values in SharePoint all item views in only in view based on configuration list [currency, Exchange date] defined<p><font size="3" face="Segoe UI Light"><strong> </strong></font></p> <p><font size="3" face="Segoe UI Light"><strong>Create </strong></font><strong><font size="3" face="Segoe UI Light">two list,</font><font size="3" face="Segoe UI Light"> </font></strong></p> <p><font face="Segoe UI Light"><font size="3">Requirement: </font></font> <p><font size="3" face="Segoe UI Light">I have 1 list with key | Exchange Rate two columns </font></p> <p><font size="3" face="Segoe UI Light">List 1:</font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">key</font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">Exchange Rate</font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">A</font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">0.5</font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">B</font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">2</font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">C</font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">2</font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">D</font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light">3</font></p></td></tr></tbody></table> <p><font size="3" face="Segoe UI Light">>>>>>>>>> </font> <p><font size="3" face="Segoe UI Light">List 2: another list Amount List Key Amount</font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">key</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">Amount</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">A 1000</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">1000</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">A 2000</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">2000</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">B 3000</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">3000</font></p></td></tr></tbody></table> <p><font face="Segoe UI Light"><font size="3">whenever users open any particular view (example test.apsx) of second list ( customized in SPD) </font></font> <p><font face="Segoe UI Light"><font size="3">I have to get below results depending upon the exchange rate defined in configuration list 1 </font></font> <p><font size="3" face="Segoe UI Light">I,e exchange rate * Amount </font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">key</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">Amount</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">A</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">500</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">A</font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">1000</font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">B </font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light">6000</font></p></td></tr></tbody></table> <p><font size="3" face="Segoe UI Light"> </font> <p><font size="3" face="Segoe UI Light">Report has been implemented in my test site, follow the process to do it. Make you’re your configuration list currency will be look up with </font> <p><a href="http://lh4.ggpht.com/-tQQhohqC-EE/UlviuCEA7LI/AAAAAAAAJnA/N7uISxNMMfw/s1600-h/clip_image001%25255B3%25255D.jpg"><a href="http://lh4.ggpht.com/-tQQhohqC-EE/UlviuCEA7LI/AAAAAAAAJnI/ik_1VBnlMSk/s1600-h/clip_image001%25255B7%25255D.jpg"><font size="3" face="Segoe UI Light"><strong><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://lh6.ggpht.com/-5gvA8XGt7KQ/Ulvivikgr1I/AAAAAAAAJlg/aqXvELUXWsA/clip_image001_thumb%25255B4%25255D.jpg?imgmax=800" width="492" height="342"></strong></font></a></a><font size="3" face="Segoe UI Light"><strong> </strong></font> <p><font size="3" face="Segoe UI Light"><strong>multiplied value </strong></font> <p><font face="Segoe UI Light"><font size="3"><strong>1) Select your column to multiple in any newly created new, select formula on the top </strong></font></font> <p><font face="Segoe UI Light"><font size="3"><strong>2) </strong></font></font> <p><a href="http://lh3.ggpht.com/-TYaTpjMuTp8/UlviwR9yyAI/AAAAAAAAJlo/I-qi3usGbN0/s1600-h/clip_image001%25255B8%25255D%25255B7%25255D.jpg"><font size="3" face="Segoe UI Light"><strong><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001[8]" border="0" alt="clip_image001[8]" src="http://lh5.ggpht.com/-nqfojpt2arU/Ulvixfc4dHI/AAAAAAAAJlw/R0JNrw4WOm4/clip_image001%25255B8%25255D_thumb%25255B5%25255D.jpg?imgmax=800" width="446" height="420"></strong></font></a><font size="3" face="Segoe UI Light"><strong> </strong></font> <p><font face="Segoe UI Light"><font size="3"><strong>3) Multiply the value with the current node as per the snap shot </strong></font></font> <p><font face="Segoe UI Light"><font size="3"><strong>4) </strong></font></font> <p><a href="http://lh6.ggpht.com/-PfZGKvGm8A8/UlviyCuy_yI/AAAAAAAAJnQ/mZLvHT0ULMU/s1600-h/clip_image003%25255B3%25255D.jpg"><a href="http://lh6.ggpht.com/-PfZGKvGm8A8/UlviyCuy_yI/AAAAAAAAJnY/PL_4x_rmAeg/s1600-h/clip_image003%25255B6%25255D.jpg"><font size="3" face="Segoe UI Light"><strong><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://lh6.ggpht.com/-JdxJVcicr0I/UlvizYb9sGI/AAAAAAAAJmI/7twJL3x18cY/clip_image003_thumb%25255B3%25255D.jpg?imgmax=800" width="515" height="315"></strong></font></a></a><font size="3" face="Segoe UI Light"><strong> </strong></font> <p><a href="http://lh6.ggpht.com/-rXYNgaQS_eM/Ulvi0QXJtMI/AAAAAAAAJmQ/l0CoWRUP1i8/s1600-h/image%25255B4%25255D.png"><font size="3" face="Segoe UI Light"><strong><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-YXArMT2Fuj4/Ulvi1Xm7cGI/AAAAAAAAJmY/p2LYff3Jw3U/image_thumb%25255B2%25255D.png?imgmax=800" width="487" height="326"></strong></font></a></p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6a7cd8cb-700d-48df-b9be-05486a44109a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/SPD" rel="tag">SPD</a>,<a href="http://technorati.com/tags/Designer" rel="tag">Designer</a>,<a href="http://technorati.com/tags/customizing+Views" rel="tag">customizing Views</a>,<a href="http://technorati.com/tags/OOTB" rel="tag">OOTB</a>,<a href="http://technorati.com/tags/Exchange+Rate" rel="tag">Exchange Rate</a></div> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:faac82a8-eec6-4eca-8f02-f3feb149a6c1" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/SPD" rel="tag">SPD</a>,<a href="http://technorati.com/tags/Designer" rel="tag">Designer</a>,<a href="http://technorati.com/tags/customizing+Views" rel="tag">customizing Views</a>,<a href="http://technorati.com/tags/OOTB" rel="tag">OOTB</a>,<a href="http://technorati.com/tags/Exchange+Rate" rel="tag">Exchange Rate</a></div> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-64440736062477885872013-10-14T05:25:00.001-07:002013-10-14T05:25:59.198-07:00Showing different values in SharePoint all item views in only in view based on configuration list [currency, Exchange date] defined<p><font size="3" face="Segoe UI Light"><strong></strong></font> </p> <p><font size="3" face="Segoe UI Light"><strong>Create two list,</strong></font> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:43f3664f-d0e5-4af0-a76c-71d37acb2430" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/SPD" rel="tag">SPD</a>,<a href="http://technorati.com/tags/Designer" rel="tag">Designer</a>,<a href="http://technorati.com/tags/customizing+Views" rel="tag">customizing Views</a>,<a href="http://technorati.com/tags/OOTB" rel="tag">OOTB</a>,<a href="http://technorati.com/tags/Exchange+Rate" rel="tag">Exchange Rate</a></div> <p><font size="3" face="Segoe UI Light"><strong>Requirement:</strong></font> <p><font size="3" face="Segoe UI Light"><strong>I have 1 list with key | Exchange Rate two columns </p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a3a63b3d-68c1-45aa-85e2-f05861351679" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/SPD" rel="tag">SPD</a>,<a href="http://technorati.com/tags/Designer" rel="tag">Designer</a>,<a href="http://technorati.com/tags/customizing+Views" rel="tag">customizing Views</a>,<a href="http://technorati.com/tags/OOTB" rel="tag">OOTB</a>,<a href="http://technorati.com/tags/Exchange+Rate" rel="tag">Exchange Rate</a></div></strong></font> <p><font size="3" face="Segoe UI Light"><strong>List 1:</strong></font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>key</strong></font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>Exchange Rate</strong></font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>A</strong></font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>0.5</strong></font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>B</strong></font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>2</strong></font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>C</strong></font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>2</strong></font></p></td></tr> <tr> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>D</strong></font></p></td> <td valign="top" width="82"> <p><font size="3" face="Segoe UI Light"><strong>3</strong></font></p></td></tr></tbody></table> <p><font size="3" face="Segoe UI Light"><strong>>>>>>>>>> </strong></font> <p><font size="3" face="Segoe UI Light"><strong>List 2: another list Amount List Key Amount</strong></font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>key</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>Amount</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>A 1000</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>1000</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>A 2000</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>2000</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>B 3000</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>3000</strong></font></p></td></tr></tbody></table> <p><font size="3" face="Segoe UI Light"><strong>whenever users open any particular view (example test.apsx) of second list ( customized in SPD)</strong></font> <p><font size="3" face="Segoe UI Light"><strong>I have to get below results depending upon the exchange rate defined in configuration list 1</strong></font> <p><font size="3" face="Segoe UI Light"><strong>I,e exchange rate * Amount </strong></font></p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>key</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>Amount</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>A</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>500</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>A</strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>1000</strong></font></p></td></tr> <tr> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>B </strong></font></p></td> <td valign="top" width="102"> <p><font size="3" face="Segoe UI Light"><strong>6000</strong></font></p></td></tr></tbody></table> <p><font size="3" face="Segoe UI Light"><strong></strong></font> <p><font size="3" face="Segoe UI Light"><strong>Report has been implemented in my test site, follow the process to do it. Make you’re your configuration list currency will be look up with </strong></font> <p><a href="http://lh4.ggpht.com/-tQQhohqC-EE/UlviuCEA7LI/AAAAAAAAJlU/v4jefUBKiA8/s1600-h/clip_image001%25255B3%25255D.jpg"><font size="3" face="Segoe UI Light"><strong><a href="http://lh4.ggpht.com/-tQQhohqC-EE/UlviuCEA7LI/AAAAAAAAJlY/vMkbMNdGspg/s1600-h/clip_image001%25255B7%25255D.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://lh6.ggpht.com/-5gvA8XGt7KQ/Ulvivikgr1I/AAAAAAAAJlg/aqXvELUXWsA/clip_image001_thumb%25255B4%25255D.jpg?imgmax=800" width="492" height="342"></a></strong></font></a> <p><font size="3" face="Segoe UI Light"><strong>multiplied value </strong></font> <p><font size="3" face="Segoe UI Light"><strong>1) Select your column to multiple in any newly created new, select formula on the top</strong></font> <p><font size="3" face="Segoe UI Light"><strong>2)</strong></font> <p><a href="http://lh3.ggpht.com/-TYaTpjMuTp8/UlviwR9yyAI/AAAAAAAAJlo/I-qi3usGbN0/s1600-h/clip_image001%25255B8%25255D%25255B7%25255D.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001[8]" border="0" alt="clip_image001[8]" src="http://lh5.ggpht.com/-nqfojpt2arU/Ulvixfc4dHI/AAAAAAAAJlw/R0JNrw4WOm4/clip_image001%25255B8%25255D_thumb%25255B5%25255D.jpg?imgmax=800" width="446" height="420"></a> <p><font size="3" face="Segoe UI Light"><strong>3) Multiply the value with the current node as per the snap shot</strong></font> <p><font size="3" face="Segoe UI Light"><strong>4)</strong></font> <p><a href="http://lh6.ggpht.com/-PfZGKvGm8A8/UlviyCuy_yI/AAAAAAAAJl4/-BDChjp3BvY/s1600-h/clip_image003%25255B3%25255D.jpg"><font size="3" face="Segoe UI Light"><strong><a href="http://lh6.ggpht.com/-PfZGKvGm8A8/UlviyCuy_yI/AAAAAAAAJmA/lGVgEZtFUBI/s1600-h/clip_image003%25255B6%25255D.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://lh6.ggpht.com/-JdxJVcicr0I/UlvizYb9sGI/AAAAAAAAJmI/7twJL3x18cY/clip_image003_thumb%25255B3%25255D.jpg?imgmax=800" width="515" height="315"></a></strong></font></a> <p><a href="http://lh6.ggpht.com/-rXYNgaQS_eM/Ulvi0QXJtMI/AAAAAAAAJmQ/l0CoWRUP1i8/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-YXArMT2Fuj4/Ulvi1Xm7cGI/AAAAAAAAJmY/p2LYff3Jw3U/image_thumb%25255B2%25255D.png?imgmax=800" width="487" height="326"></a></p> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-74480305542636133502013-10-10T10:59:00.001-07:002013-10-10T11:11:38.739-07:00What I miss about you [Katie Melua], version 2 by me<p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font></p> <p><font color="#000000"><font size="3" face="Segoe UI Light"><strong>Its a try !! don’t know how you all feel another version of this song, suggestion and corrections are always welcome.</strong></font></font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Missing the talk every night at 8.52</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Forgetting myself in our talks as you do</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The sharing of feelings that no one else knew</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">That’s what I miss about you</font> </font> <p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The every smile of yours made me mad</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Your starring eyes, melting in my smile told everything</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">How every day you used to care me</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">That’s what I miss about you</font> </font> <p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Your presence in my boring life, exciting me</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Driving in your dream every day, that was free</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Gearing up the imagination, laughing for nothing free zed me</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">You made me feel you’re mine, like fruits for tree</font> </font> <p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The way you tried to separate the parasite</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Your habit of stubborn ever never stopped</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The way you said, I am not your bite</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Pushing me like thorn of life which you chewed</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">That's what I don't miss about you</font> </font> <p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">I bet you're lying wearing the hating mask</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Spoiling the life with your own rules</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Expecting me to forget our entire task</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Knowing we are in a two different poles</font> </font> <p><font size="4" face="Segoe UI Light"></font><font color="#000000"> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The way I doubted believing others was wrong</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">This is one way of loving for few</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">The moment you are here, hearts beat prolong</font> </font> <p><font color="#000000"><font size="4" face="Segoe UI Light">Your skill of putting me down in a flash of flew</font> </font> <p><font color="#000000" size="4" face="Segoe UI Light">That’s what I don't miss about you</font></p> <p><font color="#000000"></font></p> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-39853306645716794442013-08-30T08:12:00.001-07:002013-08-30T08:16:43.082-07:00Populating the data to drop down list from another list without creating lookup column<h3><font color="#000000" size="3" face="Segoe UI Light">Populating the data to drop down list from another list without creating lookup column</font></h3> <p><font color="#000000" size="3" face="Segoe UI Light">WHY??</font></p> <p><font color="#000000" size="3" face="Segoe UI Light">few scenarios, when you have a look up column, if you delete the item from the look up, users cannot see the that item’s value where they have used in while creating</font></p> <p><font color="#000000" size="3" face="Segoe UI Light">this leads to retain the column values, also if you delete or add any items in Country (source list) the reflect in the target list where we are looking up</font></p> <p><font color="#000000" size="3" face="Segoe UI Light">OUR testers tested this scenario to solve this issue I proceeded with below approach <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:badd99d8-57ca-4056-83f7-8c9a6af31697" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/Lookup" rel="tag">Lookup</a>,<a href="http://technorati.com/tags/dropdown" rel="tag">dropdown</a>,<a href="http://technorati.com/tags/populating" rel="tag">populating</a>,<a href="http://technorati.com/tags/formfields" rel="tag">formfields</a></div></font></p> <p><font color="#000000" size="3" face="Segoe UI Light">1) Create a list</font></p> <p><font face="Segoe UI Light"><font size="3"><font color="#000000">2) add a choice or single line text column to the list, in my case </font><font color="#ff0000">country</font></font></font></p> <p><font color="#000000" size="3" face="Segoe UI Light">3) Open the list in SharePoint designer </font></p> <p><font color="#000000" size="3" face="Segoe UI Light">4) create a new form for your list</font></p> <p><font color="#000000" size="3" face="Segoe UI Light">5) you will get a web part having all the columns in the page</font></p> <p><font color="#000000" size="3" face="Segoe UI Light">6) your created choice column will look like below</font></p> <p><font color="#000000"></font><font size="3" face="Segoe UI Light"> </font></p> <p><font color="#000000" size="3" face="Segoe UI Light"></font></p><pre class="csharpcode"><font size="3" face="Segoe UI Light"><SharePoint:FormField runat=<span class="str">"server"</span> id=<span class="str">"ff25{$Pos}"</span> ControlMode=<span class="str">"New"</span> FieldName=<span class="str">"Country"</span> __designer:bind=<span class="str">"{ddwrt:DataBind('i',concat('ff25',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Country')}"</span>/></font></pre><br /><style type="text/css"><br /><br />.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }</style><br /><font size="3" face="Segoe UI Light">7) create a another row through designer. </font><br /><p><font color="#000000" size="3" face="Segoe UI Light">8) Insert data source from the ribbon. select your source list</font></p><br /><p><a href="http://lh3.ggpht.com/-gzkXLyHVz0o/UiCyeB4uFkI/AAAAAAAAG_g/C1zSGwkwbMo/s1600-h/insertdatasource%25255B5%25255D.png"><font size="3" face="Segoe UI Light"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="insertdatasource" border="0" alt="insertdatasource" src="http://lh5.ggpht.com/-JERC-sP0ts8/UiCyfLnkVNI/AAAAAAAAG_o/Vpjf3iLIii0/insertdatasource_thumb%25255B3%25255D.png?imgmax=800" width="536" height="190"></font></a></p><pre class="csharpcode"><font size="3" face="Segoe UI Light"><td <span class="kwrd">class</span>=<span class="str">"ms-formlabel"</span>><br /><SharePoint:SPDataSource runat=<span class="str">"server"</span> DataSourceMode=<span class="str">"List"</span> UseInternalName=<span class="str">"true"</span> UseServerDataFormat=<span class="str">"true"</span> selectcommand=<span class="str">"&lt;View&gt;&lt;/View&gt;"</span> id=<span class="str">"spdatasource1"</span>><br /><SelectParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></SelectParameters><br /><DeleteParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></DeleteParameters><br /><UpdateParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></UpdateParameters><br /><InsertParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></InsertParameters><br /></SharePoint:SPDataSource><br /></td></font></pre><br /><style type="text/css"><br /><br />.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }</style><br /><pre class="csharpcode"><font size="3" face="Segoe UI Light"><SharePoint:DVDropDownList Width=<span class="str">"175px"</span> runat=<span class="str">"server"</span> id=<span class="str">"ff25{$Pos}"</span> __designer:bind=<span class="str">"{ddwrt:DataBind('i',concat('ff25',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ResourceName')}"</span> Width=<span class="str">"76px"</span> selectedvalue=<span class="str">"{@ResourceName}"</span> datasourceid=<span class="str">"spdatasource1"</span> datatextfield=<span class="str">"Title"</span> datavaluefield=<span class="str">"Title"</span> /></font></pre><br /><style type="text/css"><br /><br />.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }</style><br /><br /><p><font color="#000000" size="3" face="Segoe UI Light">9) change your FORMFIELD to above control,</font></p><br /><p><font color="#000000" size="3" face="Segoe UI Light">10) Done</font></p><br /><p><font size="3" face="Segoe UI Light"></font></p> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-71176869773386289292013-08-30T07:55:00.001-07:002013-08-30T07:55:57.809-07:00Populating the data to drop down list from another list without creating lookup column<h3><font color="#000000">Populating the data to drop down list from another list without creating lookup column</font></h3> <p><font color="#000000">WHY??</font></p> <p><font color="#000000">few scenarios, when you have a look up column, if you delete the item from the look up, users cannot see the that item’s value where they have used in while creating</font></p> <p><font color="#000000">this leads to retain the column values, also if you delete or add any items in Country (source list) the reflect in the target list where we are looking up</font></p> <p><font color="#000000">OUR testers tested this scenario to solve this issue I proceeded with below approach</font></p> <p><font color="#000000">1) Create a list</font></p> <p><font color="#000000">2) add a choice or single line text column to the list, in my case </font><font color="#ff0000">country</font></p> <p><font color="#000000">3) Open the list in SharePoint designer </font></p> <p><font color="#000000">4) create a new form for your list</font></p> <p><font color="#000000">5) you will get a web part having all the columns in the page</font></p> <p><font color="#000000">6) your created choice column will look like below</font></p> <p><font color="#000000"></font> </p> <p><font color="#000000"><pre class="csharpcode"><SharePoint:FormField runat=<span class="str">"server"</span> id=<span class="str">"ff25{$Pos}"</span> ControlMode=<span class="str">"New"</span> FieldName=<span class="str">"Country"</span> __designer:bind=<span class="str">"{ddwrt:DataBind('i',concat('ff25',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Country')}"</span>/></pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br />7) create a another row through designer. </font></p><br /><p><font color="#000000">8) Insert data source from the ribbon. select your source list</font></p><br /><p><a href="http://lh3.ggpht.com/-gzkXLyHVz0o/UiCyeB4uFkI/AAAAAAAAG_g/C1zSGwkwbMo/s1600-h/insertdatasource%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="insertdatasource" border="0" alt="insertdatasource" src="http://lh5.ggpht.com/-JERC-sP0ts8/UiCyfLnkVNI/AAAAAAAAG_o/Vpjf3iLIii0/insertdatasource_thumb%25255B3%25255D.png?imgmax=800" width="536" height="190"></a></p><pre class="csharpcode"><td <span class="kwrd">class</span>=<span class="str">"ms-formlabel"</span>><br /><SharePoint:SPDataSource runat=<span class="str">"server"</span> DataSourceMode=<span class="str">"List"</span> UseInternalName=<span class="str">"true"</span> UseServerDataFormat=<span class="str">"true"</span> selectcommand=<span class="str">"&lt;View&gt;&lt;/View&gt;"</span> id=<span class="str">"spdatasource1"</span>><br /><SelectParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></SelectParameters><br /><DeleteParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></DeleteParameters><br /><UpdateParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></UpdateParameters><br /><InsertParameters><asp:parameter Name=<span class="str">"ListID"</span> DefaultValue=<span class="str">"7587B054-1CB0-4AF3-B419-1023C67EA93F"</span> /></InsertParameters><br /></SharePoint:SPDataSource><br /></td><br /></pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><pre class="csharpcode"><SharePoint:DVDropDownList Width=<span class="str">"175px"</span> runat=<span class="str">"server"</span> id=<span class="str">"ff25{$Pos}"</span> __designer:bind=<span class="str">"{ddwrt:DataBind('i',concat('ff25',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ResourceName')}"</span> Width=<span class="str">"76px"</span> selectedvalue=<span class="str">"{@ResourceName}"</span> datasourceid=<span class="str">"spdatasource1"</span> datatextfield=<span class="str">"Title"</span> datavaluefield=<span class="str">"Title"</span> /></pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><p><font color="#000000">9) change your FORMFIELD to above control,</font></p><br /><p><font color="#000000">10) Done</font></p> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-77759103540649343662013-05-16T11:03:00.001-07:002013-05-16T11:03:32.028-07:00retaining the values of lookup column after deleting the item from the look up list in SharePoint 2010<p>Hi Friends,</p> <p>there is interesting requirement came when people started testing on some of the OOTB application, we usually develop rapid OOTB application in SharePoint 2010. One of our tester is started testing the application, he was deleting the items from the look up column and customer wanted to retain those values it the list so that they can identify what was the value previously</p> <p>this can be achieved in two way</p> <p>one InfoPath</p> <p>1) if you are designing the form in in InfoPath, instead of look up column, create a single line text,</p> <p>2) make that as drop down</p> <p>3) then bring the data from the other list and on the form load bind the data.</p> <p>4) so item stored the date in a single value but user can select the data from the looked up list</p> <p>through SPD</p> <p>1) removed the form field from where you are looking the data from the newform.aspx</p> <p>2) create SPDROPDOWN control rename the IDs and all the data as per the FORM FIELDS</p> <p>3) create a connection for the look up table ( you can filter also in connection like active lookup values)</p> <p>4) add this connection data to SPDROPDOWN</p> <p>5) save the file. it works as expected</p> <p> </p> <p>Sorry I am not putting any snapshot. if anybody wants i can put those things.</p> <p>thank you. happy coding OOTB </p> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-60354933484003656412012-11-16T02:57:00.001-08:002012-11-16T02:57:57.919-08:00new line character xml in InfoPath 2010<pre class="csharpcode"><?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"UTF-8"</span>?><br /><characters <br /> cr=<span class="str">"&#xD;"</span> <br /> lf=<span class="str">"&#xA;"</span> <br /> crlf=<span class="str">"&#xD;&#xA;"</span> <br />/><br /></pre><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style> Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-77483749653255944912012-05-22T06:45:00.000-07:002012-05-22T06:45:02.106-07:00Restore a deleted site collection in SharePoint Server 2010 powershell script<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h1 class="title" style="color: #2a2a2a; font-family: 'Segoe UI', Verdana, Arial; font-size: 20px; font-weight: normal; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Restore a deleted site collection in SharePoint Server 2010</h1>
<div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
In prior versions of SharePoint Server 2010, if a site collection (that is, an <strong>SPSite</strong> object) was accidentally deleted, there was not a direct way of restoring a specific deleted site collection. The only method to restore a deleted site collection was to restore the entire farm from a backup. This was costly and time consuming, and typically was not performed.</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
When a site collection is accidentally deleted in SharePoint Server 2010 with SP1, the deleted site collection is stored in the <strong>SPDeletedSite</strong> object, not the <strong>SPSite</strong>object. Therefore, to restore a deleted site collection, you must use the <a href="http://technet.microsoft.com/en-us/library/hh286319.aspx" style="color: #960bb4; text-decoration: none;">Restore-SPDeletedSite</a> Windows PowerShell cmdlet or programmatically access the object model.</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
<br /></div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
PowerShell script</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
<br /></div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
This will restore all the deleted site the same location, if site already exists it wont, use -force to restore</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
<br /></div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
<br /></div>
<div style="margin-top: -6px;">
</div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null){</span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;"><br /></span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">Add-PSSnapin "Microsoft.SharePoint.PowerShell"</span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;"><br /></span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">}</span></div>
<br />
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px; margin-top: -6px;">
<br /></div>
<div style="margin-top: -6px;">
</div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">foreach($deletedSite in Get-SPDeletedSite)</span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">{</span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">Write-Host $</span>
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">deletedSite </span> <span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">;</span></div>
<div style="margin-top: -6px;">
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">Restore-SPDeletedSite -Identity $</span><span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;">deletedSite</span><span style="font-family: 'Segoe UI', Verdana, Arial; font-size: x-small;"> </span></div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;">
}</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;">
<br /></div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;">
happy Coding ,</div>
<div style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;">
Power of PowerShell</div>
</div>
</div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0tag:blogger.com,1999:blog-2548722450033603623.post-4307344068997741982012-05-19T05:53:00.001-07:002012-05-26T11:47:30.641-07:00upload attachments to SharePoint, replacing them with links in outlook 2010<div dir="ltr" style="text-align: left;" trbidi="on">
Hi friends,<br />
as many are asking me to how can we achieve this “"upload attachments to SharePoint, replacing them with links in outlook 2010””<br />
Here is my blog for those need help regarding the same. This I developed long back probably two years back.<br />
how to achieve this<br />
Through client object model, and you have template for the same in VS2010 to create all the links for the outlook <br />
use client object model, create a new section for SharePoint in outlook panel, provide a buttons so that people can add there own document libraries, while adding check whether they have access and add it, store them in local outlook directory of the user, <br />
when user right click on any document, there also you need to have one more links when they hover, you have to show them all the configured document libraries [Dynamically you need to read the local file and generate xml format], when they click recursively show all the folders in the document library so that they can select the folder where they want to save it, click save, it moves the document and replaced with the link, <br />
Ribbons: <br />
Top of the outlook need a ribbon so that it can be configured for all the sharepoint document link stuffs <br />
when u add outlook add in you will get a ribbon.xml there you can have your own ribbon and for click event you need to write the code of to do something good <br />
how to read attachment from the outlook mail item <br />
there is two type of classes OUTLOOK.Inspector and outlook.explorer <br />
the item within the out look will be inspector and when open a email in a single window, then it is a child to the outlook so there also you need to have same functionality <br />
<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; height: 138px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 123.93%;">
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum1" style="color: #606060;"> 1:</span> <span style="color: blue;">public</span> <span style="color: blue;">void</span> OnMyButtonClick(Office.IRibbonControl control)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum2" style="color: #606060;"> 2:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum3" style="color: #606060;"> 3:</span> List<SharePointSites> Sitelist = <span style="color: blue;">new</span> AddList().LoadXMLData();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum4" style="color: #606060;"> 4:</span> SharePointSites foundsite = Sitelist.Find(<span style="color: blue;">delegate</span>(SharePointSites s) { <span style="color: blue;">return</span> s.FullPath == control.Tag; });</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum5" style="color: #606060;"> 5:</span> <span style="color: blue;">string</span> msg = <span style="color: blue;">string</span>.Empty;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum6" style="color: #606060;"> 6:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum7" style="color: #606060;"> 7:</span> <span style="color: blue;">if</span> (control.Context <span style="color: blue;">is</span> Outlook.Inspector)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum8" style="color: #606060;"> 8:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum9" style="color: #606060;"> 9:</span> msg = <span style="color: #006080;">"Context=Inspector"</span> + <span style="color: #006080;">"\n"</span>;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum10" style="color: #606060;"> 10:</span> Outlook.Inspector insp =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum11" style="color: #606060;"> 11:</span> control.Context <span style="color: blue;">as</span> Outlook.Inspector;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum12" style="color: #606060;"> 12:</span> <span style="color: blue;">if</span> (insp.AttachmentSelection.Count >= 1)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum13" style="color: #606060;"> 13:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum14" style="color: #606060;"> 14:</span> Outlook.AttachmentSelection attachSel =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum15" style="color: #606060;"> 15:</span> insp.AttachmentSelection;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum16" style="color: #606060;"> 16:</span> <span style="color: blue;">foreach</span> (Outlook.Attachment attach <span style="color: blue;">in</span> attachSel)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum17" style="color: #606060;"> 17:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum18" style="color: #606060;"> 18:</span> Form1 form = <span style="color: blue;">new</span> Form1(attach, foundsite.SiteUrl, foundsite.SiteLibray);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum19" style="color: #606060;"> 19:</span> form.Show();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum20" style="color: #606060;"> 20:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum21" style="color: #606060;"> 21:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum22" style="color: #606060;"> 22:</span> <span style="color: blue;">else</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum23" style="color: #606060;"> 23:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum24" style="color: #606060;"> 24:</span> OutlookItem olItem =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum25" style="color: #606060;"> 25:</span> <span style="color: blue;">new</span> OutlookItem(insp.CurrentItem);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum26" style="color: #606060;"> 26:</span> msg = msg + olItem.Subject;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum27" style="color: #606060;"> 27:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum28" style="color: #606060;"> 28:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum29" style="color: #606060;"> 29:</span> <span style="color: blue;">else</span> <span style="color: blue;">if</span> (control.Context <span style="color: blue;">is</span> Outlook.Explorer)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum30" style="color: #606060;"> 30:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum31" style="color: #606060;"> 31:</span> msg = <span style="color: #006080;">"Context=Explorer"</span> + <span style="color: #006080;">"\n"</span>;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum32" style="color: #606060;"> 32:</span> Outlook.Explorer explorer =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum33" style="color: #606060;"> 33:</span> control.Context <span style="color: blue;">as</span> Outlook.Explorer;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum34" style="color: #606060;"> 34:</span> <span style="color: blue;">if</span> (explorer.AttachmentSelection.Count >= 1)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum35" style="color: #606060;"> 35:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum36" style="color: #606060;"> 36:</span> Outlook.AttachmentSelection attachSel =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum37" style="color: #606060;"> 37:</span> explorer.AttachmentSelection;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum38" style="color: #606060;"> 38:</span> <span style="color: blue;">foreach</span> (Outlook.Attachment attach <span style="color: blue;">in</span> attachSel)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum39" style="color: #606060;"> 39:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum40" style="color: #606060;"> 40:</span> Form1 form = <span style="color: blue;">new</span> Form1(attach, foundsite.SiteUrl, foundsite.SiteLibray);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum41" style="color: #606060;"> 41:</span> form.Show();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum42" style="color: #606060;"> 42:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum43" style="color: #606060;"> 43:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum44" style="color: #606060;"> 44:</span> <span style="color: blue;">else</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum45" style="color: #606060;"> 45:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum46" style="color: #606060;"> 46:</span> Outlook.Selection selection =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum47" style="color: #606060;"> 47:</span> explorer.Selection;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum48" style="color: #606060;"> 48:</span> <span style="color: blue;">if</span> (selection.Count == 1)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum49" style="color: #606060;"> 49:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum50" style="color: #606060;"> 50:</span> OutlookItem olItem =</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum51" style="color: #606060;"> 51:</span> <span style="color: blue;">new</span> OutlookItem(selection[1]);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum52" style="color: #606060;"> 52:</span> msg = msg + olItem.Subject</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum53" style="color: #606060;"> 53:</span> + <span style="color: #006080;">"\n"</span> + olItem.LastModificationTime;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum54" style="color: #606060;"> 54:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum55" style="color: #606060;"> 55:</span> <span style="color: blue;">else</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum56" style="color: #606060;"> 56:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum57" style="color: #606060;"> 57:</span> msg = msg + <span style="color: #006080;">"Multiple Selection Count="</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum58" style="color: #606060;"> 58:</span> + selection.Count;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum59" style="color: #606060;"> 59:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum60" style="color: #606060;"> 60:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum61" style="color: #606060;"> 61:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum62" style="color: #606060;"> 62:</span> <span style="color: blue;">else</span> <span style="color: blue;">if</span> (control.Context <span style="color: blue;">is</span> Outlook.AttachmentSelection)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum63" style="color: #606060;"> 63:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum64" style="color: #606060;"> 64:</span> msg = <span style="color: #006080;">"Context=AttachmentSelection"</span> + <span style="color: #006080;">"\n"</span>;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum65" style="color: #606060;"> 65:</span> Outlook.AttachmentSelection attachSel =</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum66" style="color: #606060;"> 66:</span> control.Context <span style="color: blue;">as</span> Outlook.AttachmentSelection;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum67" style="color: #606060;"> 67:</span> <span style="color: blue;">foreach</span> (Outlook.Attachment attach <span style="color: blue;">in</span> attachSel)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum68" style="color: #606060;"> 68:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum69" style="color: #606060;"> 69:</span> Form1 form = <span style="color: blue;">new</span> Form1(attach, foundsite.SiteUrl, foundsite.SiteLibray);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum70" style="color: #606060;"> 70:</span> form.Show();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum71" style="color: #606060;"> 71:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum72" style="color: #606060;"> 72:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum73" style="color: #606060;"> 73:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum74" style="color: #606060;"> 74:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum75" style="color: #606060;"> 75:</span> }</pre>
</div>
</div>
<br />
<style type="text/css">
.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br />
</style><br />
<br />
<style type="text/css">
.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br />
</style><br />
<br />
<style type="text/css">
.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br />
</style><br />
<br />
in the form i will load all the folders in the document library to which user wants to move the file, so that they can create a folder as well in library and move it thier files. <br />
<br />
<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; height: 143px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 123.35%;">
<br />
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum1" style="color: #606060;"> 1:</span> <span style="color: blue;">private</span> <span style="color: blue;">void</span> btnSave_Click(<span style="color: blue;">object</span> sender, EventArgs e)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum2" style="color: #606060;"> 2:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum3" style="color: #606060;"> 3:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum4" style="color: #606060;"> 4:</span> <span style="color: blue;">string</span> library = treeView1.SelectedNode.FullPath;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum5" style="color: #606060;"> 5:</span> <span style="color: blue;">this</span>.Close();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum6" style="color: #606060;"> 6:</span> attachment.SaveAsFile(Application.StartupPath + <span style="color: #006080;">"\\" + attachment.FileName);</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum7" style="color: #606060;"> 7:</span> Stream fStream = System.IO.File.OpenRead(Application.StartupPath + "\\<span style="color: #006080;">" + attachment.FileName);</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum8" style="color: #606060;"> 8:</span> byte[] contents = new byte[fStream.Length];</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum9" style="color: #606060;"> 9:</span> fStream.Read(contents, 0, (int)fStream.Length);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum10" style="color: #606060;"> 10:</span> fStream.Close();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum11" style="color: #606060;"> 11:</span> System.IO.File.Delete(Application.StartupPath + "\\<span style="color: #006080;">" + attachment.FileName);</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum12" style="color: #606060;"> 12:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum13" style="color: #606060;"> 13:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum14" style="color: #606060;"> 14:</span> //populate information about the new file</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum15" style="color: #606060;"> 15:</span> FileCreationInformation fci = new FileCreationInformation();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum16" style="color: #606060;"> 16:</span> fci.Url = attachment.FileName;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum17" style="color: #606060;"> 17:</span> fci.Content = contents;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum18" style="color: #606060;"> 18:</span> fci.Overwrite = true;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum19" style="color: #606060;"> 19:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum20" style="color: #606060;"> 20:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum21" style="color: #606060;"> 21:</span> try</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum22" style="color: #606060;"> 22:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum23" style="color: #606060;"> 23:</span> //get context of our sharepoint</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum24" style="color: #606060;"> 24:</span> ClientContext ctx = new ClientContext(siteURL);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum25" style="color: #606060;"> 25:</span> ctx.AuthenticationMode = ClientAuthenticationMode.Default;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum26" style="color: #606060;"> 26:</span> //get the site colleciton</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum27" style="color: #606060;"> 27:</span> Web web = ctx.Web;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum28" style="color: #606060;"> 28:</span> ctx.Load(web);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum29" style="color: #606060;"> 29:</span> ctx.Load(ctx.Web.Lists);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum30" style="color: #606060;"> 30:</span> ctx.ExecuteQuery();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum31" style="color: #606060;"> 31:</span> //get the document library folder</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum32" style="color: #606060;"> 32:</span> Folder docSetFolder = web.GetFolderByServerRelativeUrl(library);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum33" style="color: #606060;"> 33:</span> ctx.ExecuteQuery();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum34" style="color: #606060;"> 34:</span> //load the file collection for the documents in the library</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum35" style="color: #606060;"> 35:</span> FileCollection documentFiles = docSetFolder.Files;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum36" style="color: #606060;"> 36:</span> ctx.Load(documentFiles);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum37" style="color: #606060;"> 37:</span> ctx.ExecuteQuery();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum38" style="color: #606060;"> 38:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum39" style="color: #606060;"> 39:</span> //add this file to the file collection</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum40" style="color: #606060;"> 40:</span> Microsoft.SharePoint.Client.File newFile = documentFiles.Add(fci);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum41" style="color: #606060;"> 41:</span> newFile.ListItemAllFields["Title<span style="color: #006080;">"] = fci.Url;</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum42" style="color: #606060;"> 42:</span> newFile.ListItemAllFields.Update();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum43" style="color: #606060;"> 43:</span> ctx.Load(newFile, ff => ff.ListItemAllFields["Title<span style="color: #006080;">"], ff => ff.ServerRelativeUrl);</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum44" style="color: #606060;"> 44:</span> ctx.ExecuteQuery();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum45" style="color: #606060;"> 45:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum46" style="color: #606060;"> 46:</span> Outlook.MailItem current = (Outlook.MailItem)attachment.Parent;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum47" style="color: #606060;"> 47:</span> Uri FileUrl = new Uri(siteURL + newFile.ServerRelativeUrl);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum48" style="color: #606060;"> 48:</span> current.Body = string.Format("Your file <span style="color: blue;">is</span> replaced with following link\n----------------------\n<span style="color: #006080;">" + FileUrl.AbsoluteUri + "</span>\n--------------\n" + current.Body);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum49" style="color: #606060;"> 49:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum50" style="color: #606060;"> 50:</span> attachment.Delete();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum51" style="color: #606060;"> 51:</span> <span style="color: green;">//Form1_Load(sender, e);</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum52" style="color: #606060;"> 52:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum53" style="color: #606060;"> 53:</span> <span style="color: blue;">catch</span> (Exception ex)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum54" style="color: #606060;"> 54:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum55" style="color: #606060;"> 55:</span> <span style="color: blue;">this</span>.Close();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum56" style="color: #606060;"> 56:</span> MessageBox.Show(ex.Message);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum57" style="color: #606060;"> 57:</span> }</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum58" style="color: #606060;"> 58:</span> }</pre>
</div>
</div>
<br />
for ribbon,<br />
<br />
<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; height: 91px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 124.31%;">
<br />
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum1" style="color: #606060;"> 1:</span> <?xml version=<span style="color: #006080;">"1.0"</span> encoding=<span style="color: #006080;">"UTF-8"</span>?></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum2" style="color: #606060;"> 2:</span> <customUI xmlns=<span style="color: #006080;">"http://schemas.microsoft.com/office/2009/07/customui"</span> onLoad=<span style="color: #006080;">"Ribbon_Load"</span>></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum3" style="color: #606060;"> 3:</span> <ribbon></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum4" style="color: #606060;"> 4:</span> <tabs></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum5" style="color: #606060;"> 5:</span> <tab id=<span style="color: #006080;">"MyTab"</span> visible=<span style="color: #006080;">"true"</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum6" style="color: #606060;"> 6:</span> label=<span style="color: #006080;">"Share Point"</span>></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum7" style="color: #606060;"> 7:</span> <group label=<span style="color: #006080;">"MyGroup"</span> id=<span style="color: #006080;">"MyGroup"</span> ></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum8" style="color: #606060;"> 8:</span> <button id=<span style="color: #006080;">"AddList"</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum9" style="color: #606060;"> 9:</span> size=<span style="color: #006080;">"large"</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum10" style="color: #606060;"> 10:</span> label=<span style="color: #006080;">"Add lists"</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum11" style="color: #606060;"> 11:</span> screentip=<span style="color: #006080;">"Adds SharePoint lists to outlook"</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum12" style="color: #606060;"> 12:</span> supertip=<span style="color: #006080;">"Adds SharePoint lists to outlook"</span></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum13" style="color: #606060;"> 13:</span> onAction=<span style="color: #006080;">"OnAddListClick"</span>/></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum14" style="color: #606060;"> 14:</span> </group></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum15" style="color: #606060;"> 15:</span> </tab></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum16" style="color: #606060;"> 16:</span> </tabs></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum17" style="color: #606060;"> 17:</span> </ribbon></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum18" style="color: #606060;"> 18:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum19" style="color: #606060;"> 19:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum20" style="color: #606060;"> 20:</span> <contextMenus></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum21" style="color: #606060;"> 21:</span> <contextMenu idMso=<span style="color: #006080;">"ContextMenuAttachments"</span>></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum22" style="color: #606060;"> 22:</span> <dynamicMenu label=<span style="color: #006080;">"Save to SharePoint"</span> visible=<span style="color: #006080;">"true"</span> id =<span style="color: #006080;">"MyDynamicMenu"</span> getContent=<span style="color: #006080;">"getContent"</span> invalidateContentOnDrop=<span style="color: #006080;">"true"</span> /></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum23" style="color: #606060;"> 23:</span> </contextMenu></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum24" style="color: #606060;"> 24:</span> </contextMenus></pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum25" style="color: #606060;"> 25:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum26" style="color: #606060;"> 26:</span> </customUI></pre>
</div>
</div>
<pre class="csharpcode">First xml menu is for SharePoint document libray links.. so users can have there own multiple document libraries so that they can send thier attachments to any document libraries which they want.</pre>
<pre class="csharpcode"><a href="http://lh4.ggpht.com/-lCznV50aRwQ/T7eXk8jNbuI/AAAAAAAAF1o/83ReXEbor78/s1600-h/image%25255B5%25255D.png"><img alt="image" border="0" height="168" src="http://lh4.ggpht.com/-DXv1ysGW0cs/T7eXnV83a8I/AAAAAAAAF1w/IAsgxvO7aBg/image_thumb%25255B1%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><a href="http://lh6.ggpht.com/-k4moWG1aFKA/T7eXpE96HdI/AAAAAAAAF14/7RuINGnwcv8/s1600-h/image%25255B15%25255D.png"><img alt="image" border="0" height="168" src="http://lh5.ggpht.com/-8L_GQ8pSHs0/T7eXrHu1M4I/AAAAAAAAF2A/gdx3T-CghNM/image_thumb%25255B5%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="212" /></a></pre>
<pre class="csharpcode"> </pre>
<pre class="csharpcode">2nd xml context menu.. when you right click on the attachments it gives a another menu to move it to sharepoint.</pre>
<pre class="csharpcode"><a href="http://lh6.ggpht.com/-Gwj_6osywU8/T7eXtrc8T2I/AAAAAAAAF2I/ZTE_16erg0E/s1600-h/image%25255B19%25255D.png"><img alt="image" border="0" height="175" src="http://lh3.ggpht.com/-Hcy_XOSDG6Y/T7eXwj4FnrI/AAAAAAAAF2Q/e778DDnHoFE/image_thumb%25255B7%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="313" /></a></pre>
<pre class="csharpcode"><a href="http://lh4.ggpht.com/-J9QkEN9UyNo/T7eYWFZ0d8I/AAAAAAAAF2o/TdgWTJxsrWU/s1600-h/image%25255B22%25255D.png"><img alt="image" border="0" height="244" src="http://lh3.ggpht.com/-FqTFmA8sii8/T7eYZQS6qDI/AAAAAAAAF2w/HxjLMi4_Qpg/image_thumb%25255B8%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="205" /></a><a href="http://lh4.ggpht.com/-U4iI2Sh3pV4/T7eYdK6UJVI/AAAAAAAAF24/u_plJvxlscU/s1600-h/image%25255B26%25255D.png"><img alt="image" border="0" height="118" src="http://lh4.ggpht.com/-g9jVz2ykXnE/T7eYfB7w2oI/AAAAAAAAF3A/IFzEn-Madk0/image_thumb%25255B10%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="405" /></a></pre>
<pre class="csharpcode">note: getContent will pull the xml menus dynamically and create xml menus to move it to all the document libraries which previously configured<div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; height: 121px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 116.7%;">
<div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;">
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum1" style="color: #606060;"> 1:</span> <span style="color: blue;">public</span> <span style="color: blue;">string</span> getContent(Office.IRibbonControl control)</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum2" style="color: #606060;"> 2:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum3" style="color: #606060;"> 3:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum4" style="color: #606060;"> 4:</span> StringBuilder SitesXml = <span style="color: blue;">new</span> StringBuilder();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum5" style="color: #606060;"> 5:</span> <span style="color: blue;">if</span> (System.IO.File.Exists(Application.UserAppDataPath + <span style="color: #006080;">"\\" + AddList.SitesFile))</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum6" style="color: #606060;"> 6:</span> {</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum7" style="color: #606060;"> 7:</span> AddList addlist = new AddList();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum8" style="color: #606060;"> 8:</span> List<SharePointSites> ListOfSites = addlist.LoadXMLData();</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum9" style="color: #606060;"> 9:</span> SitesXml = new StringBuilder(@"<menu xmlns=<span style="color: #006080;">""</span>http:<span style="color: green;">//schemas.microsoft.com/office/2009/07/customui"" >");</span></pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum10" style="color: #606060;"> 10:</span> </pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum11" style="color: #606060;"> 11:</span> <span style="color: blue;">int</span> i = 1;</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum12" style="color: #606060;"> 12:</span> <span style="color: blue;">foreach</span> (SharePointSites item <span style="color: blue;">in</span> ListOfSites)</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum13" style="color: #606060;"> 13:</span> {</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum14" style="color: #606060;"> 14:</span> <span style="color: blue;">string</span> buttonId = <span style="color: #006080;">"button"</span> + i++;</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum15" style="color: #606060;"> 15:</span> SitesXml.Append(<span style="color: #006080;">@"<button id="</span><span style="color: #006080;">""</span> + buttonId + <span style="color: #006080;">@""</span><span style="color: #006080;">" label="</span><span style="color: #006080;">""</span> + item.SiteLibray + <span style="color: #006080;">@""</span><span style="color: #006080;">" tag="</span><span style="color: #006080;">""</span> + item.FullPath + <span style="color: #006080;">@""</span><span style="color: #006080;">" onAction="</span><span style="color: #006080;">"OnAction"</span><span style="color: #006080;">" imageMso="</span><span style="color: #006080;">"SignatureLineInsert"</span><span style="color: #006080;">"/>"</span>);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum16" style="color: #606060;"> 16:</span> SitesXml.Append(<span style="color: #006080;">@"<menuSeparator getTitle="</span><span style="color: #006080;">"GetTitle"</span><span style="color: #006080;">" />"</span>);</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum17" style="color: #606060;"> 17:</span> </pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum18" style="color: #606060;"> 18:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum19" style="color: #606060;"> 19:</span> SitesXml.Append(<span style="color: #006080;">@"</menu>"</span>);</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum20" style="color: #606060;"> 20:</span> }</pre>
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum21" style="color: #606060;"> 21:</span> <span style="color: blue;">return</span> SitesXml.ToString();</pre>
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"><span id="lnum22" style="color: #606060;"> 22:</span> }</pre>
</div>
</div>
</pre>
<br />
<style type="text/css">
.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br />
</style><br />
<br />
<a href="http://blogs.msdn.com/b/jensenh/archive/2006/04/06/569876.aspx">Source</a> - <a href="http://msdn.microsoft.com/en-us/library/ee692172.aspx">http://msdn.microsoft.com/en-us/library/ee692172.aspx</a> <br />
<a href="http://blogs.msdn.com/b/jensenh/archive/2006/04/06/569876.aspx">http://blogs.msdn.com/b/jensenh/archive/2006/04/06/569876.aspx</a> <br />
<br />
outlook <br />
<a href="http://www.dotnetspider.com/forum/163233-how-read-attachments-from-outlook-o-hard-disk.aspx">http://www.dotnetspider.com/forum/163233-how-read-attachments-from-outlook-o-hard-disk.aspx</a> <br />
<br />
VSTO Packaging, <br />
The add in needs to give it as a package, for this VSTO frame work is required to publish the addi in. sometimes client may not have the necessary environment to install the add in, in that time your package needs to get those download from the internet so that use can download the necessary framework and VSTO to carry out the installation, <br />
as we know we are using the client object model it needs to two dll on the client machine that also needs to be packaged properly, SharePoint.client and SharePoint.client.Runtime. <br />
<a href="http://lh3.ggpht.com/-UMhydjmZQXI/T7eXyflmRKI/AAAAAAAAF2Y/_ulgG7SZlKM/s1600-h/image%25255B11%25255D.png"><img alt="image" border="0" height="244" src="http://lh6.ggpht.com/-deHX2Fn7BTM/T7eX0K2i__I/AAAAAAAAF2g/WVAfpueU8l8/image_thumb%25255B3%25255D.png?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="229" /></a> <br />
if you have any doubts please free to ask me <br /><br /> </div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com1tag:blogger.com,1999:blog-2548722450033603623.post-66832993597330602162012-05-13T01:15:00.001-07:002012-05-26T11:49:46.389-07:00Message: 'length' is null or not an object<div dir="ltr" style="text-align: left;" trbidi="on">
<h6>
<span style="color: black; font-size: x-small;">Webpage error details</span></h6>
<h6>
<span style="color: black; font-size: x-small;">User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3)</span></h6>
<h6>
<span style="color: black; font-size: x-small;">Timestamp: Fri, 11 May 2012 06:35:49 UTC</span></h6>
<h6>
<span style="color: black; font-size: x-small;">Message: 'length' is null or not an object</span></h6>
<h6>
<span style="color: black; font-size: x-small;">Line: 5</span></h6>
<h6>
<span style="color: black; font-size: x-small;">Char: 18997</span></h6>
<h6>
<span style="color: black; font-size: x-small;">Code: 0</span></h6>
<h6>
<span style="font-size: x-small;">URI: http://server URL/<span style="background-color: yellow;">ScriptResource.axd</span>?d=VVc9OziZh0avVAuUDckcZctyzx1FmuIlfTSxpb_QII6eINPFIyFRp05lldCgXiHUGODRhOI7dRH8sB7WoygWB-bvRxVUiAA_CcM0h88Tga5wiu6mXazcz_yOLM3apxrWorI50qlMBWvRPH_z3BQxo-LqLPw1&t=fffffffff9d85fa6</span></h6>
While using the Ajax Toolkit in SharePoint 2010 projects, we observed very strange behaviour of Ajax controls which works in DEV totally, not working in staging in few client machines and few not. very random behaviour. this is because of compression of few script files such as ScriptResource.axd which consumes web service to run script for the Ajax controls to run. <br />
all the error which generates from these ScriptResource.axd can be handled with a simple web config change in all the server of the SharePoint 2010. <br />
I will list few script error that usually come across in SharePoint projects. <br />
If you Google with the error you wont get the solution so easily because the error related to not downloading the script file properly. <br />
Solution: <br />
add this in web config inside <system.web.extensions> <br />
<system.web.extensions><br /><scripting><br /> <scriptResourceHandler enableCompression="false" enableCaching="true"/><br /></scripting><br /></system.web.extensions><br />
List of common errors from ajax tool kit in SharePoint 2010 environment <br />
Webpage error details on the ie8 laptop.<br />
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.0.04506.30; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3)<br />Timestamp: Mon, 15 Mar 2010 15:52:33 UTC<br />
<br />Message: Invalid character<br />Line: 1<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzl4053j1XJPuK_tKVreY7-JEJHhiZGtQfbk53NzX2FfOU1&t=57268015">http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzl4053j1XJPuK_tKVreY7-JEJHhiZGtQfbk53NzX2FfOU1&t=57268015</a><br />
<br />Message: Invalid character<br />Line: 1<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzlKTEXQo2eogcWU5q9nETxLMVv7VkxkeZKcJBd3mhGGIQ1&t=57268015">http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzlKTEXQo2eogcWU5q9nETxLMVv7VkxkeZKcJBd3mhGGIQ1&t=57268015</a><br />
<br />Message: 'Sys' is undefined<br />Line: 213<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/Lists/Tasks/AllItems.aspx">http://tstsps01/Lists/Tasks/AllItems.aspx</a><br />
<br />Message: 'Sys' is undefined<br />Line: 1260<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/Lists/Tasks/AllItems.aspx">http://tstsps01/Lists/Tasks/AllItems.aspx</a><br />
<br />Message: 'Type' is undefined<br />Line: 3<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/_layouts/navresizer.js?rev=ulprP4hnQ3FxULueDoY8Vw%3D%3D">http://tstsps01/_layouts/navresizer.js?rev=ulprP4hnQ3FxULueDoY8Vw%3D%3D</a><br />
<br />Message: 'Type' is undefined<br />Line: 2<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/_layouts/sp.core.js?rev=hp5jN4e%2BPTRw7LrRxloaGg%3D%3D">http://tstsps01/_layouts/sp.core.js?rev=hp5jN4e%2BPTRw7LrRxloaGg%3D%3D</a><br />
<br />Message: 'Type' is undefined<br />Line: 1<br />Char: 1<br />Code: 0<br />URI: <a href="http://tstsps01/_layouts/ScriptResx.ashx?culture=en%2Dus&name=SP%2ERes&rev=CKSAv76LENnzrJqc86tP2g%3D%3D">http://tstsps01/_layouts/ScriptResx.ashx?culture=en%2Dus&name=SP%2ERes&rev=CKSAv76LENnzrJqc86tP2g%3D%3D</a><br />
<br />Message: Object doesn't support this property or method<br />Line: 2<br />Char: 132<br />Code: 0</div>Guruprasad Marathehttp://www.blogger.com/profile/03978025384870371227noreply@blogger.com0