tag:blogger.com,1999:blog-29794211814757189412024-03-14T17:40:17.097+05:30Sandip Patil's blogSharePoint in DNASandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-2979421181475718941.post-70518418442931361512015-08-07T16:05:00.000+05:302015-08-07T16:05:58.288+05:30Auto-numbering InfoPath forms for large SharePoint form library<div dir="ltr" style="text-align: left;" trbidi="on">
Recently i observed one issue- users were not able to create tickets on form libraries which having many items or say libraries crossed threshold limit.<br />
<br />
Some form libraries used <a href="http://www.bizsupportonline.net/browserforms/autonumber-infopath-form-submitted-sharepoint-library.htm" target="_blank"><span style="-webkit-text-stroke-width: 0px; background-color: #eeeeee; color: #333333; display: inline !important; float: none; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 28.796875px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">max(@ID) + 1</span></a> logic to get last item ID for ticket creation and some used <a href="http://blogs.msdn.com/b/infopath/archive/2007/01/15/populating-form-data-from-sharepoint-list-views.aspx" target="_blank">XML Connection using SharePoint View</a>. Both the options doesn't work for form libraries which having many items.<br />
<br />
Best solution to overcome this issue is, use REST connection to get last item ID. Use below REST URL format<br />
<br />
http://sitecollection/site/_vti_bin/ListData.svc/LibraryName()?$top=1&$orderby=Id%20desc&$select=Id<br />
<br />
Ex.<br />
<br />
http://contoso/sites/Systems/_vti_bin/ListData.svc/Tickets()?$top=1&$orderby=Id%20desc&$select=Id<br />
<br />
<br /></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-23274743064083167592015-06-02T12:00:00.000+05:302015-07-29T20:46:29.193+05:30Get all sites in a SharePoint Site Collection using the PowerShell and CSOM<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$host</span><span style="color: darkgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Runspace<span style="color: darkgrey;">.</span>ThreadOptions <span style="color: darkgrey;">=</span>
<span style="color: darkred;">"ReuseThread"</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
</div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Function definition </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">function</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: blueviolet;">Get-AllSites</span>(<span style="color: orangered;">$siteUrl</span><span style="color: darkgrey;">,</span> <span style="color: orangered;">$userName</span><span style="color: darkgrey;">,</span> <span style="color: orangered;">$password</span><span style="color: darkgrey;">,</span> <span style="color: orangered;">$domain</span>)</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">{
</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkblue;">try</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>{<span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Save
result in temp variable</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$results</span>
<span style="color: darkgrey;">=</span> @()</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Create
client context</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span>
<span style="color: darkgrey;">=</span> <span style="color: blue;">New-Object</span>
<span style="color: blueviolet;">Microsoft.SharePoint.Client.ClientContext</span>(<span style="color: orangered;">$siteUrl</span>)<span style="mso-spacerun: yes;">
</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$credentials</span>
<span style="color: darkgrey;">=</span> <span style="color: blue;">New-Object</span>
<span style="color: blueviolet;">System.Net.NetworkCredential</span>(<span style="color: orangered;">$userName</span><span style="color: darkgrey;">,</span><span style="color: orangered;">$password</span><span style="color: darkgrey;">,</span><span style="color: orangered;">$domain</span>)<span style="mso-spacerun: yes;">
</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Credentials <span style="color: darkgrey;">=</span>
<span style="color: orangered;">$credentials</span><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Get site</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$rootSite</span>
<span style="color: darkgrey;">=</span> <span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Web</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Loading root site<span style="mso-spacerun: yes;"> </span></span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Load(<span style="color: orangered;">$rootSite</span>)
</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Load(<span style="color: orangered;">$rootSite</span><span style="color: darkgrey;">.</span>Webs) </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>ExecuteQuery() </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkblue;">foreach</span>(<span style="color: orangered;">$site</span> <span style="color: darkblue;">in</span> <span style="color: orangered;">$rootSite</span><span style="color: darkgrey;">.</span>Webs){</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Load
sites under each subsite</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Load(<span style="color: orangered;">$site</span>)</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Load(<span style="color: orangered;">$site</span><span style="color: darkgrey;">.</span>Webs)</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>ExecuteQuery()</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">Write-Host</span>
<span style="color: orangered;">$site</span><span style="color: darkgrey;">.</span>Url <span style="color: navy;">-ForegroundColor</span>
<span style="color: blueviolet;">Green</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Create
object for CSV row<span style="mso-spacerun: yes;"> </span></span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$details</span>
<span style="color: darkgrey;">=</span> <span style="color: blue;">new-object</span>
<span style="color: blueviolet;">PSObject</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$details</span>
<span style="color: darkgrey;">|</span> <span style="color: blue;">add-member</span>
<span style="color: navy;">-membertype</span> <span style="color: blueviolet;">NoteProperty</span>
<span style="color: navy;">-name</span> <span style="color: darkred;">"Site
URL"</span> <span style="color: navy;">-Value</span> <span style="color: orangered;">$site</span><span style="color: darkgrey;">.</span>Url</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$results</span>
<span style="color: darkgrey;">+=</span> <span style="color: orangered;">$details</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkgreen;">#Go
for subsites if it has child sites</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkblue;">if</span>(<span style="color: orangered;">$site</span><span style="color: darkgrey;">.</span>Webs<span style="color: darkgrey;">.</span>Count <span style="color: darkgrey;">-gt</span> <span style="color: purple;">0</span>) {</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$results</span>
<span style="color: darkgrey;">+=</span> <span style="color: blue;">Get-AllSites</span>
<span style="color: orangered;">$site</span><span style="color: darkgrey;">.</span>Url
<span style="color: orangered;">$userName</span> <span style="color: orangered;">$password</span>
<span style="color: orangered;">$domain</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>} </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: orangered;">$ctx</span><span style="color: darkgrey;">.</span>Dispose()<span style="mso-spacerun: yes;">
</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>} </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkblue;">catch</span> <span style="color: darkgrey;">[</span><span style="color: teal;">System.Exception</span><span style="color: darkgrey;">]</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>{ </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">write-host</span>
<span style="color: navy;">-f</span> <span style="color: blueviolet;">red</span> <span style="color: orangered;">$_</span><span style="color: darkgrey;">.</span>Exception<span style="color: darkgrey;">.</span>ToString()<span style="mso-spacerun: yes;">
</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><span style="mso-spacerun: yes;"> </span><span style="color: darkblue;">return</span> <span style="color: orangered;">$results</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">}
</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Parameters </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteUrl</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: darkgrey;">=</span> <span style="color: darkred;">"http://contoso/sites/hr"</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userName</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: darkgrey;">=</span> <span style="color: darkred;">"username"</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$password</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: darkgrey;">=</span><span style="color: darkred;">"password"</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$domain</span><span style="color: darkgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"DOMAIN"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Add Client Object Model Assemblies<span style="mso-spacerun: yes;"> </span></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Type</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: navy;">-Path</span> <span style="color: darkred;">"C:\Program Files\Common Files\Microsoft Shared\Web
Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"</span> </span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Type</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: navy;">-Path</span> <span style="color: darkred;">"C:\Program Files\Common Files\Microsoft Shared\Web
Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"</span>
</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Call fuction</span><br />
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: orangered; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: darkgrey;">=</span> <span style="color: blue;">Get-Location</span></span></div>
</div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-AllSites</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: orangered;">$siteUrl</span>
<span style="color: orangered;">$userName</span> <span style="color: orangered;">$password</span>
<span style="color: orangered;">$domain</span> <span style="color: darkgrey;">|</span>
<span style="color: blue;">export-csv</span> <span style="color: navy;">-Path</span>
<span style="color: orangered;">$path</span><span style="color: blueviolet;">\List.csv</span>
<span style="color: navy;">-NoTypeInformation</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <span style="color: darkred;">"Report
exported to CSV, please check file on location: </span><span style="color: orangered;">$path</span><span style="color: darkred;">"</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Read-Host </span></div>
<div class="MsoNormal">
<br /></div>
</div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-31195563556593515532015-04-14T17:46:00.003+05:302015-04-14T17:46:39.728+05:30Relink InfoPath form using Nintex Workflow<div dir="ltr" style="text-align: left;" trbidi="on">
In one of my recent project i wanted to copy InfoPath Form from one library to other- second library InfoPath Form template was exactly similar but included few more fields.<br />
<br />
In second library i created workflow and used <b>Update XML</b> action, configure it as below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwefANP95U4WS4nQjTknaa9afkpHzO1MhE1CfIgCskdAkXWD2MQjN752kDtHYM9zT1rOypoYKiPoftvBRaQMVGXXNEd1T_A9A1ZCW48X02LQvi0lEy8GkabnWAm7n8eZP_dovkn3UA0FI/s1600/Update-XML.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwefANP95U4WS4nQjTknaa9afkpHzO1MhE1CfIgCskdAkXWD2MQjN752kDtHYM9zT1rOypoYKiPoftvBRaQMVGXXNEd1T_A9A1ZCW48X02LQvi0lEy8GkabnWAm7n8eZP_dovkn3UA0FI/s1600/Update-XML.jpg" height="393" width="400" /></a></div>
<br />
<b>XPath Query</b><br />
<br />
<i>/processing-instruction('mso-infoPathSolution')</i><br />
<br />
In second text box use PI information as below format.<br />
<br />
<i>name="urn:schemas-microsoft-com:office:infopath:LeaveForm:-myXSD-2015-02-27T14-45-21" solutionVersion="1.0.0.821" productVersion="15.0.0.0" PIVersion="1.0.0.0" href="https://contoso/LeaveRequestArchive/Forms/template.xsn"</i></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com3tag:blogger.com,1999:blog-2979421181475718941.post-6257869003916039412014-12-19T17:23:00.000+05:302014-12-31T11:58:32.476+05:30SharePoint Apps Privacy Policy<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;">Privacy Policies</span><br />
<br />
I am committed to protecting your privacy. The Privacy Statement applies to the SharePoint app(s) provided by using my name-<strong><u>Sandip Patil</u></strong> and governs data collection and usage. By using my SharePoint app(s), you consent to the data practices described in this statement.<br />
<br />
<b>Collection of your Personal Information</b><br />
My app(s) does not collect any personally identifiable information.<br />
<br />
<b>Sharing of Information</b><br />
My app(s) does not share or transfer any personal information with third parties.</div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.comPune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-20116611805903641552014-12-19T13:28:00.000+05:302015-01-14T13:13:06.926+05:30Lost and Found App on SharePoint App Store<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://store.office.com/lost-found-WA104379212.aspx?assetid=WA104379212" target="_blank">Lost & Found App</a> is a best place for recovery of lost and found items within a company. Just place it on home page of company intranet portal and start using it.<br />
<br />
Key features<br />
<ul style="text-align: left;">
<li>Very simple and user friendly interface</li>
<li>Simple form for items reporting</li>
<li>Autocomplete suggestions for item search</li>
<li>App part available so it's very easy to place this app on site pages</li>
<li>No administration needed </li>
</ul>
<div style="text-align: left;">
</div>
<br />
<b>App home page</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJo0k3JGkFctmlVIA-Pzkaw5eBX3WtnR4DlWdNhfW7tKLZ-T8lLLVO_5ERS9wVqy975Ng4ncGJBvYodBGsDSbo_MGUZV-2DB9-swiqtN9Ec_WO9ZFrn-L6wjp0C2SUIGgrK9Yxdfxio0/s1600/all-items.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJo0k3JGkFctmlVIA-Pzkaw5eBX3WtnR4DlWdNhfW7tKLZ-T8lLLVO_5ERS9wVqy975Ng4ncGJBvYodBGsDSbo_MGUZV-2DB9-swiqtN9Ec_WO9ZFrn-L6wjp0C2SUIGgrK9Yxdfxio0/s1600/all-items.jpg" /> </a> </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Search Item:</b> Type <u>minimum 4 characters</u> to get search results</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnYP_n8udFl523Bt4ahXutmJWQfA33wuMR15OQSyyWCT8Zhqk_2tsegFAhMbHoXTbacEYHpyTuRe6rPczvSd5L5MjZmMBRj4W4fvURdyHCY5CUPER7s-pxaPPyb1FLu7xNQyp_2g2KvbU/s1600/search-item.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnYP_n8udFl523Bt4ahXutmJWQfA33wuMR15OQSyyWCT8Zhqk_2tsegFAhMbHoXTbacEYHpyTuRe6rPczvSd5L5MjZmMBRj4W4fvURdyHCY5CUPER7s-pxaPPyb1FLu7xNQyp_2g2KvbU/s1600/search-item.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Add Item:</b> Title, Description and Category are mandatory fields </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKFPWZrSAglzEXMYIwTKHwnnhslFCGFlZDrY5bYNtagFuPrSP1OIG5z_yC8NZKcwhYMDVttumZa0DpimzJDUALmfSXqgRgFXNV1TXOXhGeqvVugjH6G2y11d4tI1KsL1r8fr-NxQoRNoI/s1600/add-lost-item.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKFPWZrSAglzEXMYIwTKHwnnhslFCGFlZDrY5bYNtagFuPrSP1OIG5z_yC8NZKcwhYMDVttumZa0DpimzJDUALmfSXqgRgFXNV1TXOXhGeqvVugjH6G2y11d4tI1KsL1r8fr-NxQoRNoI/s1600/add-lost-item.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSmex_h83GrKKBLj0x92IvCl3RuAjcIRpFwedfWjVKlja7bC0ElcG09rnVV-HVg77496l2xtDnbDVF0h-jurzzHkje38yb-v_DJxQU62lPcTdNnx8iXRshCw7ch-SQCr4o4zDmIxQz44g/s1600/add-found-item.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSmex_h83GrKKBLj0x92IvCl3RuAjcIRpFwedfWjVKlja7bC0ElcG09rnVV-HVg77496l2xtDnbDVF0h-jurzzHkje38yb-v_DJxQU62lPcTdNnx8iXRshCw7ch-SQCr4o4zDmIxQz44g/s1600/add-found-item.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Display Item:</b> Delete button is visible only for your own item</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNv1-oqbYUJt99eC_B3Xv5kuuR3g8Ots4snWNLqL6vppbkuLO_cbj8GF1WFgIKk8LnBXjw3nOJfvsCKutgZstJSl8AV_7PNx0rYSozt49lY9CTiNA9UnRcgXNWZwkE2i1baLvNFHkj21c/s1600/view-item.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNv1-oqbYUJt99eC_B3Xv5kuuR3g8Ots4snWNLqL6vppbkuLO_cbj8GF1WFgIKk8LnBXjw3nOJfvsCKutgZstJSl8AV_7PNx0rYSozt49lY9CTiNA9UnRcgXNWZwkE2i1baLvNFHkj21c/s1600/view-item.jpg" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9PL8auDTfaoI9CEEnlAqjaae1MkcNeRibKh97317d5MGQYq73wUebocbhVLxojIptoMriXBUnoeI3SSl3gobRjydVqu5qWgLmOw1OuI5f1QBvFPQSxpCkcAMrKOl6dnXMngkZuBwd08c/s1600/delete-item.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9PL8auDTfaoI9CEEnlAqjaae1MkcNeRibKh97317d5MGQYq73wUebocbhVLxojIptoMriXBUnoeI3SSl3gobRjydVqu5qWgLmOw1OuI5f1QBvFPQSxpCkcAMrKOl6dnXMngkZuBwd08c/s1600/delete-item.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>App Part:</b> Add this App as app part on the site pages</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixpVeQuV57vEsgj1Rvxu96Gx5my8xiTIFITBys87hMQv5o_h8JyUmlYSoRi6oC4yx8v9YvkQYps477iu0guEKFXQKStktAiGHVsxmR0Rtdx_QC8uQdpbDv0TjwFzVdQf3tYkfTaTfXGGE/s1600/app-part.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixpVeQuV57vEsgj1Rvxu96Gx5my8xiTIFITBys87hMQv5o_h8JyUmlYSoRi6oC4yx8v9YvkQYps477iu0guEKFXQKStktAiGHVsxmR0Rtdx_QC8uQdpbDv0TjwFzVdQf3tYkfTaTfXGGE/s1600/app-part.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I welcome your comments and suggestions. Thanks and enjoy the app..!</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-71455690663476348012014-11-20T17:29:00.002+05:302014-11-20T17:29:49.523+05:30Unable to navigate to SharePoint Hosted App and getting Invalid URL message<div dir="ltr" style="text-align: left;" trbidi="on">
Our team had been working on one SharePoint Hosted App for couple of days, one day some team members were getting Invalid URL error after installing App to Developer site. Error message is<br />
<br />
<b>Invalid URL: ~appWebUrl/Pages/Default.aspx?SPHostUrl=https%3A%2F%2Fsportsoffice%2Esharepoint%2Ecom&SPLanguage=en%2DUS&SPClientTag=18&SPProductNumber=16%2E0%2E2930%2E1217&SPListItemId=1356&SPListId={A80C0C18-8AA6-4D27-9A2A-9E7556539D94}</b><br />
<br />
We all sat together and tried to recollect what we did in last few days, we were using TFS as source control and everybody were check in their code at the EOD, so we checked version history and found that <b>Package</b> folder and package manifest lines in <b>.csproj</b> where missing in project.<br />
<br />
Due to this Visual Studio couldn't build right App package, it missed App WSP in published package.<br />
<br />
Just restoring <b>Package</b> folder and <b>.csproj</b> file fixed our issue.</div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com1Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-11358240710962152062014-11-05T19:41:00.001+05:302014-11-05T19:41:04.613+05:30Get web part assembly name and type name from SharePoint web part gallery<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Today i was trying create to custom webpart preview page as test canvas for site admins. For this i wanted to add webpart on fly. We need few properties like web part type name and web part assembly name for this.<br />
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="371">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> webPartTitle = </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"</span>
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">Content Editor
Web Part<span style="background: white; mso-highlight: white;">"</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> webPartTypeName = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> webPartAssemblyName = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPList</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> wpGallery = </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPContext</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Current.Site.GetCatalog(</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPListTemplateType</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.WebPartCatalog);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPQuery</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> wpQuery = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">new</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPQuery</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">wpQuery.Query
= </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">@"<Where><Eq><FieldRef
Name='Title' /><Value Type='Text'>"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> +
webPartTitle + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"</Value></Eq></Where>"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">SPListItemCollection</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> items = wpGallery.GetItems(wpQuery);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">if</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> (items != </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">null</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> && </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">items</span>.Count > 0)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-tab-count: 1;"> </span>webPartTypeName = items[0][</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"WebPartTypeName"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">].ToString();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>webPartAssemblyName = items[0][</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"WebPartAssembly"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">].ToString();</span></div>
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-highlight: white;">}</span><br />
<br />
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-highlight: white;">Some other useful properties are below</span><br />
<br />
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-highlight: white;">- WebPartDescription<br />- WebPartPartImageLarge<br />- LinkWebPart<br />- WebPartIcon<br />- Group<br />- QuickAddGroups </span></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-54890825890369585702014-10-13T17:15:00.001+05:302014-10-13T17:17:54.387+05:30SharePoint 2013: Use the cross-domain library in a tenant-scoped app (JSOM)<div dir="ltr" style="text-align: left;" trbidi="on">
You will find code sample for <a href="https://code.msdn.microsoft.com/SharePoint-2013-Use-the-6b3e4c1e/" target="_blank">cross-domain library in a tenant-scope app based on REST</a> call on Microsoft site but not based on JSOM. I am not very much comfortable in REST calls so i decided to created similar example in JSOM.<br />
<br />
Download sample code from <a href="https://code.msdn.microsoft.com/SharePoint-2013-Use-the-6b3e4c1e/" target="_blank">here</a> and just replace JavaScript in <b>CrossDomainExec.js</b> with below script<b><br /></b><br />
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="371">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> web;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> hostweburl;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> appweburl;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> execCrossDomainRequest() {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>hostweburl =</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>decodeURIComponent(</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>getQueryStringParameter(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'SPHostUrl'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>appweburl =</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>decodeURIComponent(</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>getQueryStringParameter(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'SPAppWebUrl'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> scriptbase = hostweburl + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'/_layouts/15/'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>$.getScript(scriptbase + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'SP.Runtime.js'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">,</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> () {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>$.getScript(scriptbase + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'SP.js'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">,</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> () { $.getScript(scriptbase + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">'SP.RequestExecutor.js'</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">,
GetWebInfo); }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> getQueryStringParameter(param) {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> params = document.URL.split(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"?"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)[1].split(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"&"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> strParams = </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">""</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">for</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> (</span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> i = 0; i < params.length; i = i + 1) {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> singleParam = params[i].split(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"="</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">if</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> (singleParam[0] == param) {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">return</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> singleParam[1];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> GetWebInfo() {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> context;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> factory;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> appContextSite;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>context = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">new</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> SP.ClientContext(appweburl);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>factory = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">new</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> SP.ProxyWebRequestExecutorFactory(appweburl);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;">
</span>context.set_webRequestExecutorFactory(factory);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">//appContextSite
= new SP.AppContextSite(context, hostweburl);</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>appContextSite = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">new</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> SP.AppContextSite(context,
document.getElementById(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"sitecoll1"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).value);</span><span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">//host url replaced
by site collection url</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> web = appContextSite.get_web();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>context.load(web);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>context.executeQueryAsync( </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>successHandler, errorHandler </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>); </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> successHandler() {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> oli = document.createElement(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"li"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>oli.innerText = web.get_title() + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">" ("</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> +
web.get_url() + </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">")"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>document.getElementById(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"WebTitles"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).appendChild(oli);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">function</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> errorHandler(sender, args) {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>document.getElementById(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"WebTitles"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).innerText
= </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Could not complete cross-domain
call: "</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> + args.get_message();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal">
<span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">}</span></div>
</div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com2Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-29151508685043015402013-10-09T16:55:00.000+05:302014-10-09T19:33:52.682+05:30Access data from other site collection in SharePoint Hosted Apps<div dir="ltr" style="text-align: left;" trbidi="on">
When we want to access data from other site collection in same web application in SharePoint-Hosted Apps then there is no option other than cross-domain library(<b><i>SP.RequestExecutor.js</i></b>).<br />
<br />
Microsoft SharePoint team has provided one of the best code sample for start point. Download solution from below link<br />
<br />
<a href="https://code.msdn.microsoft.com/SharePoint-2013-Use-the-6b3e4c1e" target="_blank">https://code.msdn.microsoft.com/SharePoint-2013-Use-the-6b3e4c1e</a><br />
<br />
<h4 style="text-align: left;">
<i>After download don't deploy it on your Developer Site, every new SharePoint App developer makes this mistake, even i. </i></h4>
<br />
<b><u>Steps to deploy and test</u> </b><br />
<br />
<ul style="text-align: left;">
<li>Just publish this solution from Visual Studio to any location so you will get an App package with extension .app. </li>
<li>Next, Create an <a href="http://msdn.microsoft.com/en-us/library/office/fp123530(v=office.15).aspx" target="_blank">App Catalog</a> site collection for testing purpose and upload this package to "Apps for SharePoint" library on this site.</li>
<li>Go to "Site Contents" page of App Catalog site and click on "add an app", select app "CrossDomainApp". You will get installing app message, wait until app get installed.</li>
<li>Once installation done, click on the app. </li>
<li>Now you will get page not found message like below</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUvsJWsdMgM5i2LrB6QRAaDKw-t5jtnXSUBfIw8T47v_gnOKsktOjnXnkdLKluqFp8t7qA5ibHWpQZ5QK-cSurtEDXwdwTyBS6WkYANahZdvZ5_ydxUo6GxbkGi0EH3VMi2Y-cbglUig/s1600/page-not-found.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUvsJWsdMgM5i2LrB6QRAaDKw-t5jtnXSUBfIw8T47v_gnOKsktOjnXnkdLKluqFp8t7qA5ibHWpQZ5QK-cSurtEDXwdwTyBS6WkYANahZdvZ5_ydxUo6GxbkGi0EH3VMi2Y-cbglUig/s1600/page-not-found.jpg" height="355" width="640" /></a></div>
<br />
<br />
you get this error because your DEV machine couldn't find the DNS mappings for this url so the next step is to add DNS mapping. On most of the DEV machines DNS Manager isn't present then how we can do this? Simple, add domain name host entry in machine <a href="c:\Windows\System32\drivers\etc">hosts</a> file but which domain name to add here.<br />
<br />
When you get page not found error your url is like below<br />
<br />
<a href="http://devmachine:1010/sites/AppCatalog/_layouts/15/appredirect.aspx?client_id=i%3A0i%2Et%7Cms%2Esp%2Eint%7C51a99a6e%2Df3eb%2D4708%2Db586%2D8cfb32360f6e%4039134774%2D6e9d%2D45b2%2D9b2c%2Dae59c3421caa&redirect_uri=%7EappWebUrl%2FPages%2FReadTitle%2Easpx%3F%7BStandardTokens%7D">http://devmachine:1010/sites/AppCatalog/_layouts/15/appredirect.aspx?client_id=i%3A0i%2Et%7Cms%2Esp%2Eint%7C51a99a6e%2Df3eb%2D4708%2Db586%2D8cfb32360f6e%4039134774%2D6e9d%2D45b2%2D9b2c%2Dae59c3421caa&redirect_uri=%7EappWebUrl%2FPages%2FReadTitle%2Easpx%3F%7BStandardTokens%7D</a><br />
<br />
You can't add domain name <i>devmachine:1010</i> as host entry but you need to add app domain host entry which is something like <i>app-22bee6440ed9fc.spapp. </i>How we'll get this entry?<br />
<br />
If you have <a href="http://www.telerik.com/download/fiddler" target="_blank">Fiddler</a> then start it and refresh that page not found page, now you will get message like below.<br />
<i><br /></i>
<br />
<b><i>[Fiddler] DNS Lookup for "app-22bee6440ed9fc.spapp" failed. System.Net.Sockets.SocketException The requested name is valid, but no data of the requested type was found </i></b><br />
<br />
Copy this app domain DNS entry <b>app-22bee6440ed9fc.spapp</b> (in your case this would be different) and add it to hosts file like below, here 127.0.0.1 is localhost IP.<br />
<br />
127.0.0.1 app-22bee6440ed9fc.spapp<br />
::1 app-22bee6440ed9fc.spapp<br />
<br />
Save hosts file and refresh the app page. You will get login prompt, put your credentials and you will get app home page.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzpZXaoPqo-5gI938vkVhVkEoQN-ErTDVEGQSYvevdO5OQOvTvL2NE6shcV7MmCUubm_7HFTKZMXDjWSeyPrpPMkKiJyHEDkGkLYHRcRurc9g5d3aXsQ2m87XY5MtUXQ0PP_0fzPWymJw/s1600/cross-domain-call-in-sharepoint-apps.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzpZXaoPqo-5gI938vkVhVkEoQN-ErTDVEGQSYvevdO5OQOvTvL2NE6shcV7MmCUubm_7HFTKZMXDjWSeyPrpPMkKiJyHEDkGkLYHRcRurc9g5d3aXsQ2m87XY5MtUXQ0PP_0fzPWymJw/s1600/cross-domain-call-in-sharepoint-apps.jpg" height="426" width="640" /></a></div>
<br />
<br />
<br />
One obvious question comes in the mind, When i deploy any app directly from Visual Studio, i don't need to add any such host entry in the hosts file? The reason is, this work is done by the Visual Studio when you deploy an app. For test purpose, just deploy an app using Visual Studio and check host file.<br />
<br /></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-2979421181475718941.post-73647790539631361642012-11-01T15:06:00.002+05:302012-11-05T16:21:14.479+05:30Service based custom timer job in SharePoint 2010<div dir="ltr" style="text-align: left;" trbidi="on">
Hi Friends,<br />
<br />
There are many articles you will find on internet about Timer Jobs in SharePoint 2010 which is based on web application but not on service. That is the reason i am sharing this article.<br />
<br />
Timer job based on web application having one major problem. i.e- Job will not work if that application not worked or crashed or say front end on which web application hosted is down.<br />
<br />
Here i will not tell whole story of Timer Job, you will get better information here<br />
<br />
<a href="http://www.simple-talk.com/dotnet/.net-tools/a-complete-guide-to-writing-timer-jobs-in-sharepoint-2010/" target="_blank">A Complete Guide to Writing Timer Jobs in SharePoint 2010</a><br />
<br />
To create timer job based on service or say service application, we will have to do few things, this are below<br />
<ul style="text-align: left;">
<li>Create custom service and add to the local farm</li>
<li>Create service <u>instance</u> based on above custom service and add this to all the servers in the farm</li>
<li>Create timer job</li>
<li>Associate timer job to service</li>
</ul>
<br />
<br />
Steps in detail<br />
<br />
1: Open Visual Studio 2010 and create farm based SharePoint Solution (use blank SharePoint Project Template), add class file named <b>CustomTimerJobService.cs, </b>code is below<br />
<br />
<br />
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Text;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Administration;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTimerJobService<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [System.Runtime.InteropServices.<span style="color: #2b91af;">Guid</span>(<span style="color: #a31515;">"6D53ECA1-E5E4-47CF-961F-28D80C8C5B98"</span>)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">CustomTimerJobService</span> : <span style="color: #2b91af;">SPService</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">const</span> <span style="color: blue;">string</span> serviceName = <span style="color: #a31515;">"Custom Timer Job Service"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//private static CustomTimerJobService local;</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJobService() { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJobService(<span style="color: #2b91af;">SPFarm</span> farm) : <span style="color: blue;">base</span>(<span style="color: #a31515;">"CustomTimerJobService"</span>, farm)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//public static CustomTimerJobService Local</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//{</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// get</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// {</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// if (CustomTimerJobService.local == null)</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// {</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// CustomTimerJobService.local = SPFarm.Local.Services.GetValue<CustomTimerJobService>("CustomTimerJobService");</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// }</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// return CustomTimerJobService.local;</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// }</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//}</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> Provision()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">base</span>.Provision();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">string</span> TypeName<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">get</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span> serviceName;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">string</span> DisplayName<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">get</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span> serviceName;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> } <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> } <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
2: Add class file named <b>CustomTimerJobServiceInstance.cs, </b>code is below</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Text;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Administration;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTimerJobService<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">CustomTimerJobServiceInstance</span> : <span style="color: #2b91af;">SPServiceInstance</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">const</span> <span style="color: blue;">string</span> serviceDescription = <span style="color: #a31515;">"Custom Service for service based timer jobs"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJobServiceInstance() : <span style="color: blue;">base</span>()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJobServiceInstance(<span style="color: blue;">string</span> name, <span style="color: #2b91af;">SPServer</span> server, <span style="color: #2b91af;">CustomTimerJobService</span> service) : <span style="color: blue;">base</span>(name, server, service)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">string</span> Description<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">get</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span> serviceDescription;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
3: Add feature of scope <b>Farm </b>to the solution and then add feature receiver.<br />
<br />
Here we will add service to the local farm, then instantiate above service on all the servers in the farm.<br />
<br /></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Runtime.InteropServices;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Security.Permissions;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Security;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Administration;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTimerJobService.Features.AddTimerJobService<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;">Guid</span>(<span style="color: #a31515;">"8daf90a1-df8a-4646-a606-0646498a6242"</span>)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">AddTimerJobServiceEventReceiver</span> : <span style="color: #2b91af;">SPFeatureReceiver</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">const</span> <span style="color: blue;">string</span> serviceName = <span style="color: #a31515;">"Custom Timer Job Service"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> FeatureActivated(<span style="color: #2b91af;">SPFeatureReceiverProperties</span> properties)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//1: Add service in local farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//2: Add service instance of this service on every server in the farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Create service definition instance </span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">CustomTimerJobService</span> timerJobService = <span style="color: blue;">new</span> <span style="color: #2b91af;">CustomTimerJobService</span>(<span style="color: #2b91af;">SPFarm</span>.Local);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Get all services from local farm and add our custom service in farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPServiceCollection</span> services = <span style="color: #2b91af;">SPFarm</span>.Local.Services;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> services.Add(timerJobService);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPFarm</span>.Local.Update();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Get all servers in local farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPServerCollection</span> servers = <span style="color: #2b91af;">SPFarm</span>.Local.Servers;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Add service instance on all the servers</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">SPServer</span> server <span style="color: blue;">in</span> servers)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Create new service instance based on our custom service and add in server</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">CustomTimerJobServiceInstance</span> timerJobServiceInstance = <span style="color: blue;">new</span> <span style="color: #2b91af;">CustomTimerJobServiceInstance</span>(serviceName, server, timerJobService);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> server.ServiceInstances.Add(timerJobServiceInstance);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> server.Update();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> FeatureDeactivating(<span style="color: #2b91af;">SPFeatureReceiverProperties</span> properties)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//1: Remove service instance of this service on every server in the farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//2: Remove service in local farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Get all servers in local farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPServerCollection</span> servers = <span style="color: #2b91af;">SPFarm</span>.Local.Servers;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">SPServer</span> server <span style="color: blue;">in</span> servers)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Remove instance on every server</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">CustomTimerJobServiceInstance</span> timerJobServiceInstance = server.ServiceInstances.GetValue<<span style="color: #2b91af;">CustomTimerJobServiceInstance</span>>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (timerJobServiceInstance != <span style="color: blue;">null</span> && timerJobServiceInstance.DisplayName.ToString().Equals(serviceName, <span style="color: #2b91af;">StringComparison</span>.OrdinalIgnoreCase))<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> server.ServiceInstances.Remove(timerJobServiceInstance.Id);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> server.Update(); <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Remove service from the farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">CustomTimerJobService</span> timerJobService = <span style="color: #2b91af;">SPFarm</span>.Local.Services.GetValue<<span style="color: #2b91af;">CustomTimerJobService</span>>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (timerJobService != <span style="color: blue;">null</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> timerJobService.Delete();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPFarm</span>.Local.Update(); <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> } <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
Next step is to create timer job and associate it to service<br />
<br />
<br />
Steps in detail<br />
<br />
1: Open Visual Studio 2010 and create farm based SharePoint Solution (use blank SharePoint Project Template), add class file named <b>CustomTimerJob.cs.cs, </b>code is below</div>
<br />
<br />
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Text;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Administration;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTimerJobDemo<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">CustomTimerJob</span> : <span style="color: #2b91af;">SPFirstAvailableServiceJobDefinition</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//If you are taking configuration values from the site where you are going </span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//to activate this timer job feature then make persisted property</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//By doing this we can use it further</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;">Persisted</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> configSiteURL = <span style="color: blue;">null</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJob()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> : <span style="color: blue;">base</span>()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> CustomTimerJob(<span style="color: blue;">string</span> jobName, <span style="color: #2b91af;">SPService</span> service, <span style="color: #2b91af;">SPSite</span> site)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> : <span style="color: blue;">base</span>(jobName, service)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">this</span>.Title = jobName;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">this</span>.configSiteURL = site.Url;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> Execute(<span style="color: #2b91af;">SPJobState</span> jobState)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (jobState.ShouldStop != <span style="color: blue;">true</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">this</span>.UpdateProgress(10);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//To Do: Do some activity here</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">this</span>.UpdateProgress(100);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
</div>
2: Add feature of scope <b>Site </b>to the solution and then add feature receiver.<br />
<br />
Here we will associate timer job to service<br />
<br />
<br />
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Runtime.InteropServices;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Security.Permissions;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Security;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Administration;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> Microsoft.SharePoint.Deployment;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTimerJobDemo.Features.CustomTimerJobDemo<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;">Guid</span>(<span style="color: #a31515;">"a26f0c48-6464-4438-bbd0-35fac5218a0b"</span>)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">CustomTimerJobDemoEventReceiver</span> : <span style="color: #2b91af;">SPFeatureReceiver</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">const</span> <span style="color: blue;">string</span> jobName = <span style="color: #a31515;">"Custom Timer Job for demo"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> FeatureActivated(<span style="color: #2b91af;">SPFeatureReceiverProperties</span> properties)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPSite</span> currentSite = properties.Feature.Parent <span style="color: blue;">as</span> <span style="color: #2b91af;">SPSite</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Check current context whether it is a normal feature activation or through any custom deployment job</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Timer job should not be created if feature activation occurs through any custom deployment job</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (!<span style="color: #2b91af;">SPImportContext</span>.Current.IsRunning)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPService</span> timerJobService = GetCustomTimerJobService();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (timerJobService != <span style="color: blue;">null</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// Remove job if it already associated with the service</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">SPJobDefinition</span> job <span style="color: blue;">in</span> timerJobService.JobDefinitions)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (job.Name.Equals(jobName, <span style="color: #2b91af;">StringComparison</span>.OrdinalIgnoreCase))<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Deleting existing job</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> job.Delete();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Create new job here</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">CustomTimerJob</span> timerJob = <span style="color: blue;">new</span> <span style="color: #2b91af;">CustomTimerJob</span>(jobName, timerJobService, currentSite);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPDailySchedule</span> dailySchedule = <span style="color: blue;">new</span> <span style="color: #2b91af;">SPDailySchedule</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> dailySchedule.BeginMinute = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> dailySchedule.EndMinute = 59;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> dailySchedule.BeginHour = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> dailySchedule.EndHour = 12;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> timerJob.Schedule = dailySchedule;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> timerJob.Update();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> } <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> FeatureDeactivating(<span style="color: #2b91af;">SPFeatureReceiverProperties</span> properties)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Get custom timer service</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPService</span> timerJobService = GetCustomTimerJobService();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (timerJobService != <span style="color: blue;">null</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">// Remove job</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">SPJobDefinition</span> job <span style="color: blue;">in</span> timerJobService.JobDefinitions)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (job.Name.Equals(jobName, <span style="color: #2b91af;">StringComparison</span>.OrdinalIgnoreCase))<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Deleting job</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> job.Delete();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: #2b91af;">SPService</span> GetCustomTimerJobService()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPService</span> timerJobService = <span style="color: blue;">null</span>; <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">string</span> serviceName = <span style="color: #a31515;">"Custom Timer Job Service"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//Get all services from the farm</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">SPServiceCollection</span> services = <span style="color: #2b91af;">SPFarm</span>.Local.Services;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">SPService</span> service <span style="color: blue;">in</span> services)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (service.DisplayName.Equals(serviceName, <span style="color: #2b91af;">StringComparison</span>.OrdinalIgnoreCase))<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> timerJobService = service;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">break</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span> (timerJobService == <span style="color: blue;">null</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">throw</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">Exception</span>(<span style="color: #a31515;">"Service not available. Please check service on servers."</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> } <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span> timerJobService;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
This is done now, you can go to central admin and run timer job or it will run based on schedule you configured for it.</div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0pt;">
Bye Good Day....!</div>
<br />
<br /></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com3Pune, Maharashtra, India18.5204303 73.856743718.3999798 73.6988152 18.6408808 74.014672199999993tag:blogger.com,1999:blog-2979421181475718941.post-4511280535638722412012-09-26T17:42:00.004+05:302012-10-26T15:58:54.296+05:30Threading example in C#<pre name="code" class="csharp">
using System;
using System.Text;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
namespace Threading_Demo
{
public class Threading
{
ArrayList data = null;
ManualResetEvent[] totalEvents = null;
public Threading(ArrayList data)
{
this.data = data;
this.totalEvents = new ManualResetEvent[data.Capacity];
}
public void ProcessThreads()
{
WaitCallback callBack = new WaitCallback(ProcessData);
int resetIndex = 0;
foreach (object item in data)
{
//Create thread and add it in pool
ThreadPool.QueueUserWorkItem(callBack, resetIndex + "#" + item);
//Create new event
totalEvents[resetIndex++] = new ManualResetEvent(false);
}
if (totalEvents != null)
{
WaitHandle.WaitAll(totalEvents);
}
}
private void ProcessData(object state)
{
string objState = state as string;
string[] stateParam = objState.Split('#');
if (stateParam.Length == 2)
{
int threadId = Convert.ToInt32(stateParam[0]);
if (!string.IsNullOrEmpty(stateParam[1]))
{
string data = stateParam[1];
//Process data
Console.Write("Thread Id: " + threadId.ToString() + " Data: " + data.ToString() + "\n");
//Signal to pool after current thread finished it's porceesing
totalEvents[threadId].Set();
}
}
}
}
class Program
{
static void Main(string[] args)
{
ArrayList data = new ArrayList(5) { "One", "Two", "Three", "Four", "Five"};
Threading thread = new Threading(data);
thread.ProcessThreads();
}
}
}
</pre>Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-83395917040274743072012-07-17T01:01:00.000+05:302012-09-26T17:06:51.821+05:30SharePoint Server 2013 released in preview along with Pro and Developer
training materialsToday is good news for SharePoint professionals, finaly Microsoft released SharePoint new version that is SharePoint Server 2013 in preview edition, though it's preview we get chance to look into it and play with new features<br/><br/>Here below are few usefull links<br/><br/><a title="SharePoint 2013 new features and capabilities" href="http://msdn.microsoft.com/en-US/sharepoint/fp123576" target="_blank">SharePoint 2013 new features and capabilities</a><br/><br/><a title="SharePoint 2013 training for developers" href="http://msdn.microsoft.com/en-US/sharepoint/fp123633" target="_blank">SharePoint 2013 training for developers</a><br/><br/><a title="What's new for developers in SharePoint 2013" href="http://msdn.microsoft.com/en-us/library/sharepoint/jj163091(v=office.15)" target="_blank">What's new for developers in SharePoint 2013</a><br/><br/><a title="Download Microsoft SharePoint Server 2013 Preview" href="http://technet.microsoft.com/en-US/evalcenter/hh973397" target="_blank">Download Microsoft SharePoint Server 2013 Preview</a>Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-10065557117619384832012-01-10T21:26:00.000+05:302012-10-26T16:25:20.935+05:30Find all ContentByQueryWebParts from the page programatically<pre name="code" class="csharp">
Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager manager = web.GetLimitedWebPartManager("Pages/default.aspx", PersonalizationScope.Shared);
foreach (Microsoft.SharePoint.WebPartPages.WebPart webPart in manager.WebParts)
{
string type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c";
Type type = webPart.GetType();
if (type.FullName.Contains("ContentByQueryWebPart")
{
//then it is ContentByQueryWebPart
}
}
</pre>Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-65088560023408675132011-08-19T18:32:00.000+05:302012-09-26T17:06:51.811+05:30Unable to open SharePoint site on host machineFew weeks back, i created one SharePoint site means a web application using Central Admin. One thing which i did different from usual is Host hearder entry. After creating site i tried to open it using host header or say fully qualified name but i couldn't open it on my local machine but though i can open it from other machines.<br/><br/>Also one more problem i was facing at the time of creating new SharPoint project from Visual Studio 2010. Error like below<br/><blockquote>Cannot connect to SharePoint Site: <a href="http://%3csitename%3e/">http://<sitename>/</a>. Make sure that this valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL Property of the project.</blockquote><br/>One of my friend gave me this useful link that i am sharing with you<br/><br/><a href="http://support.microsoft.com/kb/896861">http://support.microsoft.com/kb/896861</a><br/><br/>To create/open project in Visual Studio try to use host header URL not machine name or localhost.Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-8714515005798903332011-05-05T22:47:00.000+05:302012-10-26T17:31:18.490+05:30Sharepoint: User Type field in schema.xmlI was writting schema.xml for Custom List Template, there i need field of type User like below
<pre name="code" class="xml">
<Field
ID="{080FF274-4FAB-43c9-9710-78F3A76925DC}"
Type="User"
DisplayName="My User"
StaticName="MyUser"
Name="User"
Required="TRUE"
UserSelectionMode="PeopleOnly"
ShowField="Name" >
</Field>
</pre>
I was setting value of ShowField property to Job Title which i was using in CAML query to filter out the users. I searched lot for ShowField values of User type but i coudn't found anything from MSDN, even not an expected results from google. I am very much habitual of seeing the View Source of the HTML pages so i see the page source of Task list's User column and i got all the values from that source.
I think looking out HTML pages source is not a bad practice :)Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com1tag:blogger.com,1999:blog-2979421181475718941.post-53937312646899424372011-04-22T01:07:00.000+05:302012-10-26T16:32:00.316+05:30Webpart Preview Page: Event handler not firing in webpartToday i faced realy strange issue with button event handler in webpart, my webpart created from SharePoint webpart class. This is code
<pre name="code" class="csharp">
public class MyFirstWebPart : Microsoft.SharePoint.WebPartPages.WebPart
{
Label userName = new Label();
Button button;
protected override void CreateChildControls()
{
button = new Button();
userName.Text = "Sandip";
button.Text = "Change this text";
button.Click+=new EventHandler(button _Click);
this.Controls.Add(userName);
this.Controls.Add(button);
}
protected void button _Click(object sender, EventArgs e)
{
userName.Text = "Sandip Patil";
}
}
</pre>
I wired up event handler in CreateChildControls method so that was not an issue. Issue is with testing webpart on the page. I was testing webpart on webpart preview page. You can find webpart preview page whenever you select any webpart from webpart gallery page. After 1 hour of wasting time, i created one webpart page and put that webpart inside webpart zone. Thereafter i could see that event handler was firing. Means problem was not with the code but with testing scenario.
<blockquote><strong>Be careful when you test webpart on Webpart Preview page.</strong></blockquote>
Good Bye, Have a nice time...!Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com3tag:blogger.com,1999:blog-2979421181475718941.post-55881781709902511652011-03-11T22:20:00.000+05:302012-09-26T17:06:51.804+05:30What is new in Visual Studio 2010 for SharePoint Developer?Many of us are curious about new features of VS 2010 for SharePoint, Microsoft has provided good articles about this on their official site but we couldn't find this easily because keywords are not well defined for this entries.<br/><br/>First checkout the informational<br/><br/><a href="http://msdn.microsoft.com/en-us/library/ee290856.aspx" target="_blank">What's New in SharePoint Development</a><br/><br/>then watch below video<br/><br/><a href="http://msdn.microsoft.com/en-us/sharepoint/ff462049.aspx" target="_blank">Visual Studio 2010 for SharePoint 2010 Development</a><br/><br/>Enjoy SharePointing...!Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-4875603544461505922011-02-26T23:04:00.000+05:302012-09-26T17:06:51.800+05:30SharePoint 2010: Choice column not supported in lookupOne of the issue or we can say a bug that i found in new SharePoint 2010 version and it is confirmed from Microsoft team.<br/><br/>Issue is like this,<br/><br/>If you try to create a lookup column and select list from which you are setting lookup column, you will not get choice field columns in primary as well as secondary fields. For testing purpose take <strong>Task </strong>list and check the fields in dropdown as well as checkbox<br/><br/><strong>ID<br/>Title<br/>Modified<br/>Created<br/>Version<br/>Title (linked to item)<br/>% Complete<br/>Start Date<br/>Due Date</strong><br/><br/>You never get <strong>Priority </strong>and <strong>Status </strong>columns<br/><br/>On one of the Microsoft blog, i found a post where they say it is supporting but it's not true, Here below it is<br/><br/><em><a href="http://sharepoint.microsoft.com/Blogs/GetThePoint/Lists/Posts/Post.aspx?ID=316">Create list relationships by using lookup and unique columns </a></em><br/><br/>get confirmation from this post<br/><br/><a href="http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/5a80988a-6b37-4454-957b-856ea16b2e60">Restrictions on additional columns available for addition with Lookup column?</a><br/><br/>Hope in upcoming hotfix this bug will be solved...!<br/><br/><em><br/></em>Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com4tag:blogger.com,1999:blog-2979421181475718941.post-13567005323907028822011-02-17T21:54:00.000+05:302012-10-26T17:28:19.999+05:30Awarded Microsoft Community Contributor<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://sandipbpatil.files.wordpress.com/2011/02/mcc11_logo_horizontal_full-color.jpg" style="margin-left: 1em; margin-right: 1em;"></a></div>
Hi Friends,<br />
<br />
Today i have been awarded as <em></em><a href="http://www.microsoftcommunitycontributor.com/"><em>Microsoft Community Contributor</em></a>, Thanks Microsoft and all Friends/Microsoft Community Members who trust on me and my contributions.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcXmZ9mKHTR6yVDueP_ZO-8w4OqqEuMhNn6LqkSdzSD8IkiCaGsMaRLjZcVz9c25lYbw4B08QnSZOJ_x-o3I8ZoRv2ALQoNcHDts6qfegZlMG2iH7kKbe0m6po57WujMZtLCHMAQjYd4M/s1600/MCC11_Logo_Horizontal_Full-color.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcXmZ9mKHTR6yVDueP_ZO-8w4OqqEuMhNn6LqkSdzSD8IkiCaGsMaRLjZcVz9c25lYbw4B08QnSZOJ_x-o3I8ZoRv2ALQoNcHDts6qfegZlMG2iH7kKbe0m6po57WujMZtLCHMAQjYd4M/s1600/MCC11_Logo_Horizontal_Full-color.png" height="130" width="320" /></a></div>
<br />
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com2tag:blogger.com,1999:blog-2979421181475718941.post-9936878043776893892011-01-01T21:32:00.000+05:302012-10-26T17:01:26.600+05:30Deploying webpart in SharePoint<br />
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
We can deploy webpart to SharePoint site either deploying assembly to BIN or GAC.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Some steps are mandatory for this</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Steps<br />1: Put assembly in web application BIN or WFE's (Web Front End Server) GAC<br />2: Register assembly as safe control in web.config of web application<br />3: Add .webpart file into webpart gallery</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Let's see master's(Andrew Cornell) quote on this 3rd point</div>
<blockquote style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<div data-mce-style="text-align: justify;" style="text-align: justify;">
In order to make the Web Part discoverable, or enable users to pick the Web Part from a list of available Web Parts, a Web Part definition file must exist in one of two places: the Web Part Gallery in a top – level site of a site collection or the wpcatalog folder within the Web root of a site ’ s hosting Web application. If the Web Part definition is deployed to the wpcatalog folder, all sites within all site collections within the Web application will have access to the Web Part. However, if the Web Part definition is added to the Web Part Gallery, a special document library in the top - level site of a site collection, only the sites within that site collection will be able to add the Web Part to their pages.</div>
</blockquote>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
In this post we will concentrate on deploying webpart only to BIN.</div>
<h3 data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; text-align: justify;">
A) Manual Deployment</h3>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
A.1: Add webpart assembly (<WebPartName>.dll) to Bin directory of web application</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Web application path would be <em>C:inetpubwwwrootwssVirtualDirectoriesPort_No</em></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
A.2: Add Safe control entry to web.config file of web application</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Example.</div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">
</pre>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;"><SafeControl Assembly="<WebPartName>" Namespace="<WebPartName>" TypeName="*" Safe="True" />
</pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
OR</div>
<pre><span style="color: #333333; font-family: Consolas, Monaco, monospace;"><span style="font-size: 12px; line-height: 18px;">
</span></span></pre>
<pre><span style="color: #333333; font-family: Consolas, Monaco, monospace;"><span style="font-size: 12px; line-height: 18px;"><SafeControl Assembly="<WebPartName>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="<WebPartName>" TypeName="*" Safe="True" /></span></span></pre>
<pre><span style="color: #333333; font-family: Consolas, Monaco, monospace;"><span style="font-size: 12px; line-height: 18px;">
</span></span></pre>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
A.3: Add webpart to webpart gallery</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
Here we will not add any .webpart file to webpart gallery but this task will done by SharePoint itself. See how this is done.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br />Go to webpart gallery from "Site Actions". Click "New" and select your webpart assembly and populate it. This action actually create .webpart file for you webpart.<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
You can see this file content too. Click on "Edit" button in front of webpart in galley, then click "View XML" and save .webpart file. Open this file in notepad and see the xml markup.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
A.4: Use webpart</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
Now open webpart page, edit it and put webpart in webpart zone.</div>
<h3 data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; text-align: justify;">
B) Deployment by WSP package</h3>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
B.1: Create solution for deployment</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
Create separate class library project in same solution which is totally a dummy project, we will not use it's assembly for deployment but it will help us to make deployment structure. Add one folder named "Defination" then copy your webpart assembly(DLL) there.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
B.2: Create one text file and save it as manifest.xml, manifest file is actually a instruction file to STSADM utility which tells him where to place the files on server.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
manifest.xml</div>
<pre><span style="color: #333333; font-family: Consolas, Monaco, monospace;"><span style="font-size: 12px; line-height: 18px;">
<Solution xmlns='http://schemas.microsoft.com/sharepoint/' SolutionId='A54EF786-3131-4f6c-AF90-A7116DF2B814'>
<Assemblies>
<Assembly DeploymentTarget='WebApplication' Location='sandip.helloworldwebpart.dll'>
<SafeControls>
<SafeControl Assembly="sandip.helloworldwebpart" Namespace="sandip.helloworldwebpart" TypeName="*" Safe="True" />
</SafeControls>
</Assembly>
</Assemblies>
</Solution>
</span></span></pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Above schema tells to STSADM that put my webpart assembly (sandip.helloworldwebpart.dll) into BIN folder of respective application and add safe control entry into web.config file of that application.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.3: Create one text file and save it as inst.ddf, ddf(data definition file or diamond directive file) file is actually a instruction file to makecab utility which tells him how to create a package.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
inst.ddf</div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">
.Set CabinetNameTemplate="sandiphellowworldwebpart.wsp"
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP;** All files are compressed in cabinet files
.Set MaxDiskFileCount=1000 ; Limit file count per cabinet
.Set UniqueFiles='OFF'
.Set Cabinet=on
.Set DiskDirectory1="../Defination"
manifest.xml
sandip.helloworldwebpart.dll
</pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Above schema tells to makebcab that create package of name “sandiphellowworldwebpart.wsp", put manifest file and assembly to root of<br />WSP package and save it into current directory.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.4: Create WSP package</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Open command line and go to Defination folder of your deployment project</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<em>C:Documents and Settingssandip.patilMy DocumentsVisual Studio 2008ProjectsWSSsandip.helloworldwebpartDeploymentDefination></em></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
and run this command</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
makecab /f inst.ddf</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Now you will get package in same folder. To confirm files in WSP package, copy/paste package(.wsp) file on same directory and change extension to .cab. Open cab file and see 2 files (manifest.xml, sandip.helloworldwebpart.dll) should be there.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.5: Create deployment/retraction file</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Deployment file will add package to solution store and deploy to respective application.<br />Retraction file will retract solution (delete webpart from BIN and safe control from your web application) and delete solution from solution store.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
DeploySolution.cmd</div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">
:begin
@echo off
set solutionName=sandiphellowworldwebpart
set url=http://sandip:6666
@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH%
echo --- Adding solution %solutionName% to solution store...
stsadm -o addsolution -filename %solutionName%.wsp
echo --- Deploying solution %solutionName%...
stsadm -o deploysolution -name %solutionName%.wsp -url %url% -immediate -allowCasPolicies -force
stsadm -o execadmsvcjobs
if errorlevel == 0
echo ### Error deploying solution %solutionName%
echo .
goto end
</pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
RetractSolution.cmd</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;"> :begin
@echo off
set solutionName=sandiphellowworldwebpart
set url=http://sandip:6666
@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH%
echo --- Attempting to deactivate/retract existing solution...
stsadm -o retractsolution -name %solutionName%.wsp -url %url% -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name %solutionName%.wsp -override
rem stsadm -o execadmsvcjobs
</pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.6: Deploy solution package and confirm it</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Double click DeploySolution.cmd and see webpart assembly(DLL) in your web application BIN and safe control entry in web.config too. You can see there is minor difference in safe control entry which is placed by there by STSADM and our manifest file entry.</div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">
</pre>
<pre><span style="color: #333333; font-family: Consolas, Monaco, monospace;"><span style="font-size: 12px; line-height: 18px;"><SafeControl Assembly="sandip.helloworldwebpart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=48cc2196eaf8dbe7" Namespace="sandip.helloworldwebpart" TypeName="*" Safe="True" /></span></span></pre>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">
</pre>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Don't worry about this change.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.7: Add webpart to webpart gallery and use it.<br />When we deploy webpart using WSP package without feature, our .webpart file is placed into wpcatalog directory in the application.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
Path could be <em>C:inetpubwwwrootwssVirtualDirectoriesPort_No</em></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
This insure that our webpart will available in all site collections of the application and ready to use, Follow A.4 steps to use webpart on the pages.</div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
<br /></div>
<div data-mce-style="text-align: justify;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; text-align: justify;">
B.8: (Optional)Retract solution package and confirm it<br />If you don't need this solution then retract it by running RetractSolution.cmd file.<br />Double click RetractSolution.cmd and see webpart assembly(DLL) in your web application BIN and safe control entry in web.config has been removed.</div>
<br />
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com1tag:blogger.com,1999:blog-2979421181475718941.post-8008225054820690362010-12-30T23:03:00.000+05:302012-10-26T17:09:26.319+05:30Introduction to Webparts in Sharepoint<h3>
About WebParts</h3>
<div>
<br /></div>
Microsoft first introduced Web Parts in Windows SharePoint Services (WSS) 2.0. Information workers and developers quickly adopted Web Parts because they enable end users to modify the content, appearance, and behavior of pages through a browser.<br />
Not only could users easily modify the content and experience with the browser, but they could also modify pages for just their own experience, rather everyone ’ s shared experience. Web Parts became so popular that the ASP.NET team decided to add a Web Part Framework to ASP.NET 2.0. The ASP.NET 2.0 implementation is different from the WSS 2.0 implementation in that ASP.NET 2.0 adds a new component to the page: the WebPartManager . The WebPartManager control is responsible for managing all aspects of Web Parts on the page. It knows what Web Parts are allowed on the page, what Web Parts are already on the page and which Web Part zones they are in, any connections that have been established between two Web Parts, as well as the personalization data for each Web Part. Personalization data contains all the settings, or values, set on the public properties, for a Web Part. This is very different from the WSS 2.0 Web Part Framework in that each Web Part maintained its own connection and personalization information and Web Part zones managed which Web Parts were in each zone.<br />
<br />
<h3>
What happens when a Web Part is added to a Web Part zone?</h3>
<div>
<br /></div>
SharePoint adds some XML to the Web Part zone that contains information about the assembly<br />
containing the Web Part and the Web Part class itself. This XML also contains the values of the public<br />
properties on the Web Part class.<br />
<br />
<WebPart xmlns=”http://schemas.microsoft.com/WebPart/v2” xmlns:iwp=”http://schemas.microsoft.com/WebPart/v2/Image”><br />
<Assembly> Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c </Assembly><br />
<TypeName> Microsoft.SharePoint.WebPartPages.ImageWebPart </TypeName><br />
<FrameType> None </FrameType><br />
<Title> Watch My Gears Run </Title><br />
<iwp:ImageLink> /_layouts/images/GEARS_AN.GIF </iwp:ImageLink><br />
</WebPart><br />
<br />
This XML, shown in above, is then stored as personalization information for a specific user (if the personalization scope is set to User) or for all users who access the page (if the personalization scope is set to Shared) depending on the mode of the page. The next time a page is requested, SharePoint loads the personalization information for the Web Part, which tells it which class to load from which assembly and the values of the public properties to set on that class. The Web Part is then loaded within the ASP.NET 2.0 page life cycle, which generates the rendered HTML output.<br />
<br />
<h3>
WebParts Base Classes</h3>
<div>
<br /></div>
Microsoft has provided two base classes from which developer can create custom web parts<br />
<strong>ASP.NET 2.0 </strong>— System.Web.UI.WebControls.WebParts.WebPart<br />
<strong>WSS / SharePoint 3.0 </strong>— Microsoft.SharePoint.WebPartPages.WebPart<br />
<br />
<h3>
Why to use ASP.Net web part class not SharePoint web part class?</h3>
<div>
<br /></div>
When creating a new Web Part, Microsoft ’ s recommendation is to always create ASP.NET 2.0 Web Parts instead of SharePoint - specific Web Parts. Web Parts created from ASP.Net web part class (<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpart.aspx">System.Web.UI.WebControls.WebParts.WebPart</a>) are fully supported in Windows SharePoint Services, and can be used not only in ASP.NET applications but also in Windows SharePoint Services too. The SharePoint <strong>web part</strong> class was designed specifically for SharePoint sites, and Web Parts that inherit from this class can be used only in Windows SharePoint Services sites.<br />
When creating new Web Parts, you have the option of creating Web Parts that inherit from <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpart.aspx">System.Web.UI.WebControls.WebParts.WebPart</a> (recommended) or <strong>Microsoft.SharePoint.WebPartPages.WebPart</strong>. The Windows SharePoint Services <strong>WebPart</strong> class exists primarily for the purpose of backward compatibility (Web Parts written for Windows SharePoint Services 2.0 continue to work in Windows SharePoint Services 3.0 without modification).<br />
<br />
<span class="divider"><em><span style="text-decoration: underline;">References</span></em></span><br />
<a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-SharePoint-2007-Web-Content-Management-Development-Building-Publishing-Sites-with-Office-SharePoint-Server-2007.productCd-0470224754.html">Professional SharePoint 2007 Web Content Management Development</a><br />
<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart%28v=office.12%29.aspx">Webpart Class</a>Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com1tag:blogger.com,1999:blog-2979421181475718941.post-17383395894157287282010-10-22T01:05:00.000+05:302012-09-26T17:06:51.792+05:30Break the variation in SharepointMost of the Sharepoint Developers/Content Editors facing below problem in Variation feature of MOSS.<br/><blockquote><em><strong>Publishing a page in the variation source site overwrites all contents in the target site</strong></em></blockquote><br/>If below variation settings are ON.<br/><ul><br/> <li>Automatically create site and page variations</li><br/> <li>Recreate a new target page when the source page is republished.</li><br/> <li>Update Web Part changes to target pages when variation source page update is propagated.</li><br/></ul><br/>Case is like this,<br/><br/>First time when we create page XYZ in source variation(English) this page will automatically get created on target variation site(French). Then content editor add some content to this page and publish it. That contents will also get reflected to target page but that is not in French because Sharepoint will not do the task of content translation. This time content editor edit content on French site and publish it.<br/><br/>Now everything is working fine till new change.<br/><br/>After some days there is one minor change in English site. Hence content editor do that change and publish it. Now disaster came into his life.<br/><br/>All the contents of French page get overwritten by English page.<br/><br/>Now we will talk about the workarounds.<br/><br/>1: Temporary solution<br/><blockquote>Go to the target page version history and restore current published major version.</blockquote><br/>2: Permanent solution<br/><blockquote>Attempt this once page created on first time. Delete target(French) page when it automatically created. Create new page with same name in target(French). This will break variation link between source and variation page. Add/Update the content and publish it.<br/><br/>By doing this you will see an error in Variation log<br/><br/><em>An error occurred during page variation creation. A page already exists at the target location:</em><br/><br/>Don't worry...! This error is coming because we breaked variation link. This will happen on every update on source page<em>.</em></blockquote><br/>Cheers! Now enjoy content editing.Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-22420818312494253812010-08-21T20:27:00.000+05:302012-09-26T17:06:51.794+05:30Benefits of detaching publishing page from page layoutIn the publishing feature of Sharepoint every page must be derived from the page layout. This page layout actually decide the look and feel plus contents of the page, so if u use one layout more than a page then it is difficult to manage the look and feel because if u make change in page layout then this changes are automatically reflected on all the pages which using this page layout.<br/>Sharepoint designer has given one nice functionality to <a href="http://office.microsoft.com/en-us/sharepoint-designer-help/create-and-manage-publishing-pages-HA010174133.aspx#BM2" target="_blank">detach the page from it's layout</a>. By detaching page from it's layout, page got a following benefits.<br/><ul><br/> <li> All the content fields and page fields can be used on the page.</li><br/> <li> Use any designs templates to the page,this will not affect to other pages.</li><br/> <li>Getting advantage of using DataView, FormView webparts etc.</li><br/></ul><br/>That's all here.Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0tag:blogger.com,1999:blog-2979421181475718941.post-44429061608869444852010-02-09T19:56:00.000+05:302012-10-26T17:22:55.568+05:30List Tree View in Sharepoint<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
In one of our project there are more than 100 lists and every list is having nested folders as well as many items. My client don't want to dig the list to see all the nested folder inside it. So we decided to provide him the Tree View control which will show all the lists inside site and also show all the items/data inside a list and he can easily navigate to particular list/folder and item.<br />
<br />
First we will show all the items/nested folder in TreeView<br />
<br />
using System;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.Utilities;<br />
<br />
namespace Nishnat.ListTreeView<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public class ListItems : WebControl<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public string ListName { get; set; }<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// render the control<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>base.RenderContents(writer);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected override void CreateChildControls()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>base.CreateChildControls();<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>using (SPSite ospSite = new SPSite("http://localhost:7777/"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>using (SPWeb web = ospSite.RootWeb)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPList list = web.Lists[ListName];<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPFolder rootFolder = list.RootFolder;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeView listTree = new TreeView();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.ShowLines = true;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.ExpandDepth = 0;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode rootNode = new TreeNode();<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//Bind tree<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MakeTreee(rootFolder, rootNode);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// add the root node to tree view<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.Nodes.Add(rootNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.Controls.Add(listTree);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>catch(Exception ex)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>throw ex;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private void MakeTreee(SPFolder rootFolder, TreeNode rootNode)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPQuery query = new SPQuery();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>query.Folder = rootFolder;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPWeb web = rootFolder.ParentWeb;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPListItemCollection listColl = web.Lists[rootFolder.ParentListId].GetItems(query);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>foreach (SPListItem subitem in listColl)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (subitem.Folder != null) //Is folder<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode childNode = new TreeNode(subitem.Folder.Name,subitem.ID.ToString(), "_layouts/images/folder.gif", <span class="Apple-tab-span" style="white-space: pre;"> </span>subitem.Folder.ServerRelativeUrl, "");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootNode.ChildNodes.Add(childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MakeTreee(subitem.Folder, childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>string displayURL = GetDisplayUrl(subitem);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode childNode = new TreeNode(subitem.Name, subitem.Name, "", displayURL, "");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootNode.ChildNodes.Add(childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static string GetDisplayUrl(SPListItem item)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPList list = item.ParentList;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPWeb web = list.ParentWeb;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>string dispUrl = item.ContentType.DisplayFormUrl;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//dispUrl = String.Format("{0}/{1}?ID={2}", web, dispUrl, item.ID);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (dispUrl == "")<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>bool isLayouts = dispUrl.StartsWith("_layouts/", StringComparison.CurrentCultureIgnoreCase);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = String.Format("{0}/{1}?ID={2}", web, dispUrl, item.ID);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (isLayouts)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = String.Format("{0}&amp;List={1}", dispUrl, SPEncode.UrlEncode(list.ID + ""));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return dispUrl;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
<br />
Second we will show all the Lists/items/nested folder in TreeView<br />
<br />
<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.Utilities;<br />
<br />
namespace Nishnat.ListTreeView<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public class AllListsWithItems : WebControl<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// render the control<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>base.RenderContents(writer);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected override void CreateChildControls()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>base.CreateChildControls();<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>using (SPSite ospSite = new SPSite("http://localhost:7777/"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>using (SPWeb web = ospSite.RootWeb)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeView listTree = new TreeView();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.ShowLines = true;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.ExpandDepth = 0;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPListCollection listAll = web.Lists;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>foreach (SPList list in listAll)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPFolder rootFolder = list.RootFolder;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode rootNode = new TreeNode(list.Title,list.ID.ToString(),list.ImageUrl,list.ParentWebUrl,"");<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//Bind tree<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MakeTreee(rootFolder, rootNode);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// add the root node to tree view<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listTree.Nodes.Add(rootNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.Controls.Add(listTree);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>catch(Exception ex)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>throw ex;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private void MakeTreee(SPFolder rootFolder, TreeNode rootNode)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPQuery query = new SPQuery();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>query.Folder = rootFolder;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPWeb web = rootFolder.ParentWeb;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPListItemCollection listColl = web.Lists[rootFolder.ParentListId].GetItems(query);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>foreach (SPListItem subitem in listColl)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (subitem.Folder != null) //Is folder<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode childNode = new TreeNode(subitem.Folder.Name,subitem.ID.ToString(), "_layouts/images/folder.gif", subitem.Folder.ServerRelativeUrl, "");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootNode.ChildNodes.Add(childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MakeTreee(subitem.Folder, childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>string displayURL = GetDisplayUrl(subitem);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TreeNode childNode = new TreeNode(subitem.Name, subitem.Name, "", displayURL, "");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootNode.ChildNodes.Add(childNode);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static string GetDisplayUrl(SPListItem item)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPList list = item.ParentList;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SPWeb web = list.ParentWeb;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>string dispUrl = item.ContentType.DisplayFormUrl;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//dispUrl = String.Format("{0}/{1}?ID={2}", web, dispUrl, item.ID);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (dispUrl == "")<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>bool isLayouts = dispUrl.StartsWith("_layouts/", StringComparison.CurrentCultureIgnoreCase);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = String.Format("{0}/{1}?ID={2}", web, dispUrl, item.ID);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (isLayouts)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispUrl = String.Format("{0}&amp;List={1}", dispUrl, SPEncode.UrlEncode(list.ID + ""));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return dispUrl;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
<br />
* Add assembly into GAC and Bin application<br />
<br />
* Register the control on the page<br />
<br />
<br />
<@ Register Tagprefix="Nishnat" Namespace="Nishnat.ListTreeView" Assembly="Nishnat.ListTreeView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=57c7737278844f55"><br />
<br />
<br />
* Now Use it on the page<br />
<br />
<Nishnat:ListItems Id="listItems" runat="server" ListName="Books"><br />
</Nishnat:ListItems><br />
<Nishnat:AllListsWithItems Id="AllListsWithItems" runat="server"><br />
</Nishnat:AllListsWithItems><br />
<div>
<br /></div>
Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com9tag:blogger.com,1999:blog-2979421181475718941.post-24877083753891945862009-06-04T19:36:00.000+05:302012-10-26T17:24:23.540+05:30Rename title field of list programatically in Sharepoint<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=2979421181475718941" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<br />
//Get the site<br />
SPWeb web = SPContext.Current.Web;<br />
<br />
// Get the list<br />
SPList list = web.Lists["List Name"];<br />
web.AllowUnsafeUpdates = true;<br />
<br />
list.Fields["Title"].Title = "New Title";<br />
list.Fields["Title"].Description = "This is description of field.";<br />
list.Fields["Title"].Update(); //Don't forget to update list field<br />
<br />
//Update list<br />
list.Update();<br />
web.AllowUnsafeUpdates = false;Sandip Patilhttp://www.blogger.com/profile/11480391753929142962noreply@blogger.com0