tag:blogger.com,1999:blog-48109712562414836302024-02-19T05:56:58.005-05:00Bramer FuMy thoughts and ideas about IT; whatever IT is...Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.comBlogger67125tag:blogger.com,1999:blog-4810971256241483630.post-38383072206011325472015-12-08T11:47:00.001-05:002015-12-08T11:51:17.877-05:00Cannot create SharePoint 2010 site collections<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: inherit;">You heard that right... Fixing the ability to create site collections within SharePoint. Recently, I was tasked to get 3 environments in sync (DEV/TEST/PROD). Part of this task was to set up <a href="http://www.harbar.net/articles/sp2010ups.aspx" target="_blank">User Profiles</a> and <a href="http://sharepointgeorge.com/2010/configuring-my-site-sharepoint-2010/" target="_blank">My Sites with Self-Service Site Creation</a> enabled.</span><br />
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Setting up DEV and TEST went rather smoothly. At that point, I should have known there was a hidden whammie that would ruin a whole weekend of mine. I'm so naive sometimes...</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<h2 style="text-align: left;">
<span style="font-family: inherit;">Cannot Create Site Collections Error</span></h2>
<div>
<span style="font-family: inherit;">This madness came to the forefront after setting up My Sites. One of the last steps is to create a site collection with a template of My Sites Host. While trying to create this site collection, I get a stack trace in my face:</span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Failed to load receiver assembly "Microsoft.Office.Server.Powerpoint.Web.MOSSHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" for feature "PowerPointServer" (ID: 5709298b-1876-4686-b257-f101a923f58d).: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Server.Powerpoint.Web.MOSSHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Office.Server.Powerpoint.Web.MOSSHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. &ErrorCorrelationId=c01e4e3a-1a39-401d-9b67-5a38961a7bd9</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;">Clearly there is errant code running that isn't in the other two environments. Reading the error, it's easy to discern there's a problem with that assembly. Looking into the GAC, I noticed that this .dll didn't even exist.</span></div>
<div>
<br /></div>
<div>
<img src="https://s-media-cache-ak0.pinimg.com/736x/c3/82/13/c3821321c620ae437da5d2d14afe00ec.jpg" style="-webkit-user-select: none;" /></div>
<div>
<br /></div>
<div>
I said this to myself... </div>
<div>
<br /></div>
<div>
It's early in the outage window, so I jumped into triage mode. Googling that error, there is not much out there at all. That was disheartening and a punch in the gut. There's nothing like fixing an error that didn't come up in DEV or TEST and nothing of value on the net to fix it.</div>
<div>
<br /></div>
<div>
Looking more into the error, it's easy to see there's a feature that is running this code:</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Failed to load receiver assembly "Microsoft.Office.Server.Powerpoint.Web.MOSSHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" for feature "<span style="background-color: #cccccc; color: red;">PowerPointServer</span>"</span></div>
<div>
<br /></div>
<div>
Based on that feature being available to the farm, I was able to discern that <a href="https://technet.microsoft.com/en-us/library/ee837419(v=office.14).aspx" target="_blank">Office Web Apps</a> has been installed. But why isn't this working and why is the .dll missing from the GAC? Reading over the <a href="https://technet.microsoft.com/en-us/library/hh230314(v=office.14).aspx#BKMK_UninstallStdAlone" target="_blank">uninstallation steps for Office Web Apps</a>, it became very apparent that this component was previously installed and then removed. For some reason, the features are still activated within the farm. GREAT!!! There goes my weekend...</div>
<div>
<br /></div>
<h2 style="text-align: left;">
Find and Remove the Office Web Apps Feature</h2>
<div>
Before last weekend, I hadn't much knowledge of installing or configuring Office Web Apps, so needless to say, I treaded lightly. First up was to find the feature that I thought was the culprit. Using this PowerShell command, I was able to peruse the features within the farm:</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Get-SPFeature -Limit All | Out-File -FilePath "$pwd\spfeatures.log" </span></div>
<div>
<br /></div>
<div>
Armed with this, it's easy to find the OfficeWebApps feature. But that feature is scoped to a Site!</div>
<div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OfficeWebApps 0c504a5c-bcea-4376-b05e-cbca5ced7b4f Site </span></div>
<div>
<br /></div>
<div>
That cannot be the problem since I don't even have a site collection! So, I tried to create a site collection in a different web app, thinking maybe it was something with the My Site stuff. NO BUENO. Same stack trace in my face... Directly below this feature in the log is another feature that looked very promising:</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OfficeWebAppsStapling fb67f269-fd1d-4f9a-af0b-50f5755e19d7 Farm </span></div>
</div>
<div>
<br /></div>
<div>
The name of this feature and since this is scoped to the farm, I got the warm and fuzzies. Since Office Web Apps wasn't in Programs and Features and the .dll was missing from the GAC, I decided that I could safely uninstall this feature from the farm altogether.</div>
</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Uninstall-SPFeature -Identity "fb67f269-fd1d-4f9a-af0b-50f5755e19d7"</span></div>
<div>
<br /></div>
<div>
Once this was uninstalled, I hit paydirt. I was able to create site collections again! </div>
<div>
<br /></div>
<div>
As an aside, this farm hadn't created a new site collection in well over 2 years. Check the created dates on your own farm sometime.</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Get-SPSite -Limit All | % { $_.RootWeb.Created }</span></div>
<div>
<br /></div>
<div>
Beware of using -Limit All, it may cause a degradation in performance.</div>
<div>
<br /></div>
<h2 style="text-align: left;">
Another Office Web Apps Error</h2>
<div>
It was only a small victory in the lengthy weekend battle. Now that the site collection is created, it's only natural to enjoy the fruits of you labor. Upon visiting the site, I'm thrown and error with a Correlation ID. TO THE ULS!!!</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Error initializing Safe control - Assembly:Microsoft.Office.SharePoint.ClientExtensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c TypeName: Microsoft.Office.SharePoint.ClientExtensions.Publishing.TakeListOfflineRibbonControl Error: Could not load type 'Microsoft.Office.SharePoint.ClientExtensions.Publishing.TakeListOfflineRibbonControl' from assembly 'Microsoft.Office.SharePoint.ClientExtensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.</span></div>
<div>
<br /></div>
<div>
What we have here is ANOTHER .dll missing from the GAC. If you've been following along, you're probably yelling the answer out. Uninstall the OTHER Office Web Apps feature. I originally chose not too, since I was treading lightly. :)</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Uninstall-SPFeature -Identity "0c504a5c-bcea-4376-b05e-cbca5ced7b4f"</span></div>
<div>
<br /></div>
<div>
I'm now able to visit the My Sites site collection! Now it's time to click on My Content and create my own personal site collection. No whammies, no whammies, no whammies!!!</div>
<div>
<br /></div>
<div>
UGH!!! I can't get that lucky... Another stack trace in my face.</div>
<div>
<br /></div>
<div>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgec01QpN10wcvPbBBd0QlUq9-7Jwb6DN5IDjj_iHNiIW-Tt5LHAQcdh0ZYpXWWtJ7lZx3qdcIQG8LZpHl1lwC4AiHzJfmqZxJXqFz37EIwjF5TKR_4boPPUOdjCLrq8-nr_CPguil7GCk/s1600/image%5B1%5D.png" style="-webkit-user-select: none;" /></div>
<div>
<br /></div>
<h2 style="text-align: left;">
My Sites Error</h2>
<div>
After clicking My Content, the site collection was being provisioned and started the best Mr. Burns impression I can. Not so fast...</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC2MjKfpyn1LNTultB3zasJKwTOwjCn7Kz4DytuV0gaFKQUz-asaBBgrF9OnoGMOVmOcblziUJV-UHF06VZNRLCdCeoyph0Pt6AsJzPi0e-aaGSp3WH0SXCuy7qmNv43pAz0o3w96KOOxp/s1600/MySites+Error.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="136" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC2MjKfpyn1LNTultB3zasJKwTOwjCn7Kz4DytuV0gaFKQUz-asaBBgrF9OnoGMOVmOcblziUJV-UHF06VZNRLCdCeoyph0Pt6AsJzPi0e-aaGSp3WH0SXCuy7qmNv43pAz0o3w96KOOxp/s640/MySites+Error.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<blockquote class="tr_bq">
<br />
<i>There has been an error creating the personal site. Contact your site administrator for more information.</i></blockquote>
<div>
<br /></div>
<div>
Unfortunately, this doesn't come with a Correlation ID, but the ULS will tell all. Cracking open ULS Viewer and watching the ULS log live, I found........ You guessed it ANOTHER missing .dll that's related to Office Web Apps. Are you starting to find a theme within this post?</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">The following exception occurred: Failed to load receiver assembly "Microsoft.Office.Excel.Server.HostExtensionWac, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" for feature "ExcelServerEdit" (ID: b3da33d0-5e51-4694-99ce-705a3ac80dc5).: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Excel.Server.HostExtensionWac, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Office.Excel.Server.HostExtensionWac, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> at System.Reflection.Assembly.Load(String assemblyString) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].</span></div>
</div>
<div>
<br /></div>
<div>
This one made me pause a little bit more, because it's not clear if this feature is a default feature of the farm. Treading lightly, I opted to simply disable this one and not uninstall completely, just in case.</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Disable-SPFeature –identity "ExcelServerEdit" -URL http://webapp</span></div>
<h2 style="text-align: left;">
Wrap up</h2>
<div>
I'm not sure how or why Office Web Apps was removed, but the features that come with this component were still activated and made for an interesting weekend, nonetheless. I was able to find some great resources out there for My Sites troubleshooting. If you ever run into issues with this, I'd definitely take a look at these two links:</div>
<div>
<ul style="text-align: left;">
<li><a href="http://www.sharepointdiary.com/2013/03/sharepoint-2010-my-site-creation-error.html" target="_blank">http://www.sharepointdiary.com/2013/03/sharepoint-2010-my-site-creation-error.html</a></li>
<li><a href="https://technet.microsoft.com/en-us/library/gg750250(v=office.14).aspx" target="_blank">https://technet.microsoft.com/en-us/library/gg750250(v=office.14).aspx</a></li>
</ul>
</div>
<div>
As for Office Web Apps, I found an update that lists what I would assume to be most of the .dlls that can be found within. It helped me along the way:</div>
<div>
<ul style="text-align: left;">
<li><a href="https://support.microsoft.com/en-us/kb/2520047" target="_blank">https://support.microsoft.com/en-us/kb/2520047</a></li>
</ul>
</div>
<div>
<br /></div>
<div>
I hope this helps someone save some precious weekend hours...</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-78351211900257930062014-04-15T08:50:00.003-04:002014-04-15T09:50:37.917-04:00Large Lists, BCS, Excel REST, JSOM, CSVs and Office 365 OH MY!<div dir="ltr" style="text-align: left;" trbidi="on">
An interesting challenge came across my desk last week:<br />
<blockquote class="tr_bq">
"How can we import a CSV into Office 365 and use that data to tag other items within the site. The CSV currently has ~7600 rows and is expected to grow. We'll also need to re-import the CSV on an ad-hoc basis when the data changes."</blockquote>
The last part of that was the real issue. There was simply no easy way of doing that. After trying a few things, falling flat on my face, I'm prepared to share my exploration into the different options.<br />
<br />
<ul style="text-align: left;">
<li><a href="https://draft.blogger.com/blogger.g?blogID=4810971256241483630#BCS">BCS</a></li>
<li><a href="https://draft.blogger.com/blogger.g?blogID=4810971256241483630#JSOM">Custom List - JSOM</a></li>
<li><a href="https://draft.blogger.com/blogger.g?blogID=4810971256241483630#ExcelREST">Excel REST API</a></li>
<li><a href="https://draft.blogger.com/blogger.g?blogID=4810971256241483630#CSV">CSV</a></li>
</ul>
Each have their own merits and pitfalls. This post will examine each and try to shed some light on the pitfalls I've found using each of these.<br />
<br />
<h3 id="BCS" style="text-align: left;">
BCS</h3>
<a href="http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/make-an-external-list-from-a-sql-azure-table-with-business-connectivity-services-and-secure-store-HA102933008.aspx">Wiring up an ECT on Office 365</a> can be a little finicky. I initially had some issues due to 2 BDC Models that were created for the same ECT. After calling in the eagle-eyed BCS guru, <a class="g-profile" href="https://plus.google.com/117428901260390401438" target="_blank">+Fabian Williams</a>, I got squared away.<br />
<br />
Immediately after that, I could tell that I was not going to be able to use BCS for what I needed. In Office 365, there is a hard limit of 2000 items that can be retrieved. Ironically, the error message that is displayed is not a supported cmdlet for Office 365.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS2nD2opFpPJ0YW9UDnqJxjHRuAejcZRb2dPqzw1WoPB4re9qJY-qxo38Vwb6pIGBgbAaHqSS4Dg-eCKJEFOSn2PmmPJQ5nBbKQKXxh4RAz528SMGzF1vzGNDq0X0rXX7ie6aXtUP5JA0j/s1600/BCS_Throttling_Error.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS2nD2opFpPJ0YW9UDnqJxjHRuAejcZRb2dPqzw1WoPB4re9qJY-qxo38Vwb6pIGBgbAaHqSS4Dg-eCKJEFOSn2PmmPJQ5nBbKQKXxh4RAz528SMGzF1vzGNDq0X0rXX7ie6aXtUP5JA0j/s1600/BCS_Throttling_Error.jpg" height="22" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Office 365 BCS Throttle Error</td></tr>
</tbody></table>
Adding insult to injury, I decided to run a simple test using JSOM. I wanted to clarify if JSOM would provide me <a href="http://msdn.microsoft.com/en-us/library/office/ee557461(v=office.14).aspx">PagingInfo</a> with a BCS List. Using the code below, you'd expect line 68 to produce a value instead of nothing at all.<br />
<br />
<script src="https://gist.github.com/iOnline247/10669812.js"></script>
<br />
Since BCS will not work and due to the limitation of the API, I had to look for another solution.<br />
<br />
<h3 id="JSOM" style="text-align: left;">
Custom List</h3>
<div>
Using a custom list initially worked great. I'm able to use JSOM, query the list for 5000 items per trip to the server, <b>AND</b> get PagingInfo. Using the code below works great for this scenario.<br />
<br /></div>
<script src="https://gist.github.com/iOnline247/10670900.js"></script>
<br />
<div>
Importing the Excel into Office 365 is relatively straightforward and will work for most needs. The file I used had about ~7600 rows of data. After importing the file, I noticed the Server Resource Quota was tapped.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGDNtM5WkorUyG9ldGdabCnBFuaO1wrzLmabNEhHGMJhDxxpzWvyeyjEPASmKh_V9gIs4ZXrf27HhDEKC52L6_dsmEty9UO1Av6tTYnij_Tp5nLrLV6_5WhsL9wAARPWcESQp_6bDNxg_t/s1600/ServerResourceUtilization.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGDNtM5WkorUyG9ldGdabCnBFuaO1wrzLmabNEhHGMJhDxxpzWvyeyjEPASmKh_V9gIs4ZXrf27HhDEKC52L6_dsmEty9UO1Av6tTYnij_Tp5nLrLV6_5WhsL9wAARPWcESQp_6bDNxg_t/s1600/ServerResourceUtilization.jpg" height="278" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Office 365 Server Utilization</td></tr>
</tbody></table>
So using this approach has 2 problems. I will not be able to do a mass import again of my data (the list already exists) and the Server Resource Quota points are exhausted.<br />
<br /></div>
<div>
<h3 id="ExcelREST" style="text-align: left;">
Excel REST</h3>
</div>
<div>
This seemed like a cool way of getting around the limitations above, so I dove in to find out if this will work for my needs. After all, I'm allowed to have a *lot* of rows in Excel and I'll be able to easily update the file, since it's in a document library. Using the code below, I ran into a showstopper though.<br />
<br />
<script src="https://gist.github.com/iOnline247/10672870.js"></script>
<br />
There is a <a href="http://msdn.microsoft.com/en-us/library/office/jj163211(v=office.15).aspx#xlsSystemQueryOptions">hard limit in the API set at 500 rows</a>. That would be painfully slow to get all of the items or even worse; a user may try to use the form control while this is still querying for data.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aHHYeJcdHqpFTlcWlDYgbECGN0hD0hG4UTj0B1wWqe3-2Ks1yEAH-jWota_2hHXiki43nv8PqxU_mDP8MMV2LAGkQefCkdyct9wzd_jEO6IchmhmU8KEjBdzCAtbOPBfLUP6pyIFgc5U/s1600/ExcelREST_Limitation.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aHHYeJcdHqpFTlcWlDYgbECGN0hD0hG4UTj0B1wWqe3-2Ks1yEAH-jWota_2hHXiki43nv8PqxU_mDP8MMV2LAGkQefCkdyct9wzd_jEO6IchmhmU8KEjBdzCAtbOPBfLUP6pyIFgc5U/s1600/ExcelREST_Limitation.jpg" height="241" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Excel REST API - 500 row limit</td></tr>
</tbody></table>
So that leaves us with our raw data that was exported from SQL and given to us to use.<br />
<br />
<h3 id="CSV" style="text-align: left;">
CSV</h3>
</div>
<div>
Updating the CSV will be easy, since it will be stored in a document library. Now all we need to be able to do is make sense of it. Using the code below, I'm able to parse the CSV and create an array of objects that I need to pass off to another library. Also note the use of <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage">localStorage</a>. This is a nice way to cache the data and prevent the retrieval/processing of the data client-side on every page load. If the CSV is updated, simply clear the browser cache and you'll get the latest and greatest.<br />
<br /><script src="https://gist.github.com/iOnline247/10674795.js"></script></div>
<h3 style="text-align: left;">
Conclusion</h3>
<div>
All approaches have their merits and pitfalls... BCS and PagingInfo, I'm looking at you! If the ad-hoc mass-import wasn't needed, then using list driven data would have been my choice. If I used that approach, I would have still used localStorage though. It makes sense to cache the processed data since it'll not change very much. Since my solution works client-side, I'll have to take into consideration the amount of time this takes to render. I'm getting good performance out of the CSV approach, so I'm going to stick with it for the time being.</div>
</div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com7tag:blogger.com,1999:blog-4810971256241483630.post-18366580394608185292014-01-10T03:00:00.000-05:002014-03-06T09:33:53.148-05:00Fire Workflows with Initiation Parameters using #SPServices<div dir="ltr" style="text-align: left;" trbidi="on">
Firing Workflows using Javascript, I've never had to pass in Initiation Parameters. This post takes a look at how to do just that and provides some code that will allow easy use of Workflows in Javascript.<br />
<br />
<h3 style="text-align: left;">
Setup Workflow</h3>
<div>
The workflow has to be set for Manual starting, otherwise this will not work. Also, to pass in parameters to the workflow, you'll need to have Initiation Variable(s) within the workflow. I've only fiddled with Number and Single Line of Text fields, so if you use other column types, feel free to share your experience.</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOTI6IfM3BzFW37IDD3lGKAksjZi2dU7FVHXvArJNjP-d_6sMtbjxqHsshSozyhpDpCL05SQ2nQUj4pc7t0P4myqB9m6KxY9-CxNDtBlu078ICfVY_LbMlLrssCXaOy6nAvKLZp0UPdjR9/s1600/image.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOTI6IfM3BzFW37IDD3lGKAksjZi2dU7FVHXvArJNjP-d_6sMtbjxqHsshSozyhpDpCL05SQ2nQUj4pc7t0P4myqB9m6KxY9-CxNDtBlu078ICfVY_LbMlLrssCXaOy6nAvKLZp0UPdjR9/s1600/image.png" height="212" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Workflow Initiation Parameters</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
This workflow is simply logging the variables out to the Workflow History. Easy peazy...</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Workflow Parameters</h3>
<div>
Looking over the documentation for <a href="http://spservices.codeplex.com/" target="_blank">SPServices </a>and <a href="http://spservices.codeplex.com/wikipage?title=StartWorkflow&referringTitle=Workflow" target="_blank">StartWorkflow</a>, I found some examples that were a great starting point. After fiddling a bit with 1 field, I decided to test this a little more. I created a column with spaces in the Name field <b>*gasp*</b>. I only did this to see how to handle this programmatically, so a word to the wise:<b><i> Friends don't let friends create columns with spaces...</i></b></div>
<div>
<br /></div>
<div>
Reading over the examples, if you have multiple parameters, it says you have to change from passing the column name to this weird pattern: </div>
<div>
<br /></div>
<div>
<pre><code><Data><Parameter1>" + parameter1 + "</Parameter1><Parameter2>" + parameter2 + "</Parameter2></Data></code></pre>
</div>
<div>
<br /></div>
<div>
I've found this to not work at all for me at all [sad_panda]... Back to the drawing board, I guess. Then an idea came to me. Since I'm targeting a column with a space in it, I tried what normally happens to spaces in Static Names: <b>_x0020_</b>. So, I tried this next:<br />
<br />
<pre><code><Data><TextField>Will it blend?</TextField><With_x0020_Spaces>42</With_x0020_Spaces</code>></Data></pre>
<br />
However, this didn't work either! Very curious to find a resolution, I set out to find out why this didn't work... Using SPD (SharePoint Designer), you are able to view the files generated by the workflow. Opening up the XML file as text, you can clearly see that SPD removed the space in the Static Name.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_9hUMeMna3qWammX919yX-3W4JRIe77W2UhsGV_JH6crdzXvW5m_RnvCTpYhZzshEkpq1vD6RlQ2_dRwX6jIA_aHeOGlGO2gomf1pdpHZdPQMVrFzpP_YM9Qb_qNpUm1D9rBRhgWJfcV5/s1600/WorkflowXML.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_9hUMeMna3qWammX919yX-3W4JRIe77W2UhsGV_JH6crdzXvW5m_RnvCTpYhZzshEkpq1vD6RlQ2_dRwX6jIA_aHeOGlGO2gomf1pdpHZdPQMVrFzpP_YM9Qb_qNpUm1D9rBRhgWJfcV5/s1600/WorkflowXML.png" height="210" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Workflow wfconfig.xml</td></tr>
</tbody></table>
Within this file, all of the Initiation Parameters are visible and it's now easy to tell what's exactly going on.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFNQ0NRD8ZQ1ra0ApO0ihjHJpm0HR9NOsBLedsdIBbDjZGgbAUOF_gTnq9qJWgn0WxV4LdVNNfITG3LCo3dQuicAuK1Pm_t5AaKKk-RENGMTbHfDnz4ycJtJwrQO7syeBwrGK6l_KJxPty/s1600/WorkflowXMLasText.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFNQ0NRD8ZQ1ra0ApO0ihjHJpm0HR9NOsBLedsdIBbDjZGgbAUOF_gTnq9qJWgn0WxV4LdVNNfITG3LCo3dQuicAuK1Pm_t5AaKKk-RENGMTbHfDnz4ycJtJwrQO7syeBwrGK6l_KJxPty/s1600/WorkflowXMLasText.png" height="73" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Workflow Parameter Names</td></tr>
</tbody></table>
For all of this to work while using multiple parameters, you have to use the exact Static Name as defined in the XML. The workflow parameters below work just fine for me now.</div>
<div>
<br /></div>
<div>
<pre><code><Data><TextField>Will it blend?</TextField><WithSpaces>42</WithSpaces</code>></Data></pre>
</div>
<h3 style="text-align: left;">
Code to Fire the Workflow</h3>
<div>
This function will handle the pain of getting a workflow to fire. All you need to know is the correct URL, the workflow name, and the workflow parameters ( if any ).<br />
<br /></div>
<div>
<b>*** Update ***</b>
I took my original idea and made it more or less a plug-in for SPServices. Add this function to the SPServices source and it'll work without any issues.
<script src="https://gist.github.com/iOnline247/9099157.js"></script>
Original function:
<script src="https://gist.github.com/iOnline247/8341141.js"></script></div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com2tag:blogger.com,1999:blog-4810971256241483630.post-70880860767576178542013-11-22T10:40:00.000-05:002013-11-22T10:40:39.843-05:00Use Server Variables In XSLT To Find The Root Site<div dir="ltr" style="text-align: left;" trbidi="on">
There’s no way to tell what the site’s Root Web URL will be, nor the protocol used on any given site, so here’s a quick rundown of how to get the Root Web URL using XSLT:<br />
<h3>
Variable Setup</h3>
This example requires these two <a href="http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx" target="_blank">server variables</a>.<br />
<ul>
<li>SERVER_NAME</li>
<li>HTTPS</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9zkp2QToXJBEWPjOWeOAIyfxUjYCXVXG_D_2LsWgYaA74lWtOZJDTr7gpkUGpXNNy9wIibG8CvZnCNVnEJSj2GMBIAiL_u1pMAGpzxTLoB_lXs0NS1fgrEv7hmWHLBHdzMViZ8A1D9cSm/s1600-h/ServerVariable%252520-%252520SERVER_NAME%25255B8%25255D.png" style="margin-left: 1em; margin-right: 1em;"><img align="left" alt="ServerVariable - SERVER_NAME" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8HcEuIW-8myqxxm3v0v5fw5R7QiOtWgNDamIVLxFNGECnN0hBQNzTY86k7i2PzJ2QrtgDStCn4-YigqLesghyY4ajIwb9EQVux3Lyjk1WD7QjHv6DF84MdsCngAJK-1t7Fh355jQ6JICw/?imgmax=800" height="264" style="background-image: none; border: 0px; display: inline; float: left; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="ServerVariable - SERVER_NAME" width="434" /></a></div>
Here’s a screenshot of what it looks like in SPD. With these in place we'll be able to determine the Root Web URL dynamically, so this could be used on any site and the code will know exactly what the URL of the root web is.<br />
<h3>
<br /></h3>
<h3>
<br /></h3>
<h3>
<br /></h3>
<div>
<br /></div>
<h3>
XSLT Code</h3>
I've commented the key parts to this simple example, so if you want to just take those pieces you can. Doing this through the GUI, it adds two <ParameterBinding />’s to your code. Later in the code, you’ll see two variables that are used:<br />
<ul>
<li>httpProtocol</li>
<li>sitePath</li>
</ul>
<div>
These variables are put together to form the URL of the Root Web.</div>
<span style="font-family: 'courier new', courier;"><br /></span>
<span style="font-family: 'courier new', courier;"><WebPartPages:DataFormWebPart runat="server" Description="" PartOrder="2" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="True" DataSourceID="" Title="" ViewFlag="8" NoDefaultStyle="TRUE" AllowConnect="True" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="True" ExportMode="All" Dir="Default" DetailLink="" ShowWithSampleData="True" ListId="" ListName="" FrameType="None" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ManualRefresh="False" ChromeType="None" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" ViewContentTypeId="" InitialAsyncDataFetch="False" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ID="" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/></span><br /><span style="font-family: 'courier new', courier;"> </span><br /><span style="font-family: 'courier new', courier;"> <!-- Set these two variables up within your DVWP/XLV Web Part --></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="HTTPS" Location="ServerVariable(HTTPS)" DefaultValue=""/></span><br /><span style="font-family: 'courier new', courier;"> <ParameterBinding Name="SERVER_NAME" Location="ServerVariable(SERVER_NAME)" DefaultValue=""/></span><br /><span style="font-family: 'courier new', courier;"> </ParameterBindings></span><br /><span style="font-family: 'courier new', courier;"><DataFields></span><br /><span style="font-family: 'courier new', courier;">@myField,</span><span style="font-family: 'courier new', courier;">myField</span><span style="font-family: 'courier new', courier;">;</DataFields></span><br /><span style="font-family: 'courier new', courier;"><Xsl></span><br />
<span style="font-family: 'courier new', courier;"> <xsl:stylesheet xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema%22">http://www.w3.org/2001/XMLSchema"</a> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="<a href="http://schemas.microsoft.com/WebParts/v2/DataView/runtime%22">http://schemas.microsoft.com/WebParts/v2/DataView/runtime"</a> xmlns:asp="<a href="http://schemas.microsoft.com/ASPNET/20%22">http://schemas.microsoft.com/ASPNET/20"</a> xmlns:__designer="<a href="http://schemas.microsoft.com/WebParts/v2/DataView/designer%22">http://schemas.microsoft.com/WebParts/v2/DataView/designer"</a> xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform%22">http://www.w3.org/1999/XSL/Transform"</a> xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"></span><br /><span style="font-family: 'courier new', courier;"> <xsl:output method="html" indent="no"/></span><br /><span style="font-family: 'courier new', courier;"> <xsl:decimal-format NaN=""/></span><br /><span style="font-family: 'courier new', courier;"> <xsl:param name="dvt_apos">&apos;</xsl:param></span><br /><span style="font-family: 'courier new', courier;"> <xsl:param name="ManualRefresh"></xsl:param></span><br /><span style="font-family: 'courier new', courier;"> <xsl:param name="webUrl" /></span><br /><span style="font-family: 'courier new', courier;"> <xsl:param name="HTTPS" /></span><br /><span style="font-family: 'courier new', courier;"> <xsl:param name="SERVER_NAME" /></span><br /><span style="font-family: 'courier new', courier;"> <xsl:variable name="dvt_1_automode">0</xsl:variable></span><br />
<span style="font-family: 'courier new', courier;"> <xsl:template match="/" xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema%22">http://www.w3.org/2001/XMLSchema"</a> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:asp="<a href="http://schemas.microsoft.com/ASPNET/20%22">http://schemas.microsoft.com/ASPNET/20"</a> xmlns:__designer="<a href="http://schemas.microsoft.com/WebParts/v2/DataView/designer%22">http://schemas.microsoft.com/WebParts/v2/DataView/designer"</a> xmlns:SharePoint="Microsoft.SharePoint.WebControls"></span><br /><span style="font-family: 'courier new', courier;"> <xsl:call-template name="dvt_1"/></span><br /><span style="font-family: 'courier new', courier;"> </xsl:template></span><br />
<span style="font-family: 'courier new', courier;"> <xsl:template name="dvt_1"></span><span style="font-family: courier new, courier;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/></span><br />
<span style="font-family: 'courier new', courier;"> <xsl:variable name="dvt_RowCount" select="count($Rows)"/></span><br /><span style="font-family: 'courier new', courier;"> <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" /></span><br /><span style="font-family: 'courier new', courier;"> <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/></span><br />
<span style="font-family: 'courier new', courier;"> <!-- Use this variable to determine the protocol used by the site --></span><br /><span style="font-family: 'courier new', courier;"> <xsl:variable name="httpProtocol"></span><br /><span style="font-family: 'courier new', courier;"> <xsl:choose></span><br /><span style="font-family: 'courier new', courier;"> <xsl:when test="normalize-space($HTTPS) = 'on'"><a href="https://%3C/xsl:when">https://</xsl:when</a>></span><br /><span style="font-family: 'courier new', courier;"> <xsl:otherwise><a href="http://%3C/xsl:otherwise">http://</xsl:otherwise</a>></span><br /><span style="font-family: 'courier new', courier;"> </xsl:choose></span><br /><span style="font-family: 'courier new', courier;"> </xsl:variable></span><br />
<span style="font-family: 'courier new', courier;"> <!-- This variable concats all of these variables together --></span><br /><span style="font-family: 'courier new', courier;"> <!-- Example sitePath output: <a href="http://ionline247.me/">http://iOnline247.me/</a> --></span><br /><span style="font-family: 'courier new', courier;"> <xsl:variable name="sitePath"></span><br /><span style="font-family: 'courier new', courier;"> <xsl:value-of select="string(normalize-space(concat(concat(normalize-space($httpProtocol), normalize-space($SERVER_NAME)), '/')))" /></span><br /><span style="font-family: 'courier new', courier;"> </xsl:variable> </span><br /><span style="font-family: 'courier new', courier;"> </span><br /><span style="font-family: 'courier new', courier;"> <!-- {...SNIP...} --></span><br /><span style="font-family: 'courier new', courier;"> </xsl:template></span><br /><span style="font-family: 'courier new', courier;"> </xsl:stylesheet></span><br /><span style="font-family: 'courier new', courier;"></Xsl></span><br />
<br />
The end result is a nice URL. Here’s a sample output: <a href="http://ionline247.me/">http://iOnline247.me/</a><br />
I'm not sure why the protocol isn't straightforward to get. I may have missed something obvious, but I didn't see any other way of determining the protocol. If there's an easier way, feel free to let me know.</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-40563661759578005582013-11-18T15:27:00.000-05:002013-11-18T15:27:08.592-05:00Add SublimeText to Windows Context Menu<div dir="ltr" style="text-align: left;" trbidi="on">
Since I've made the switch, I've loved <a href="http://www.sublimetext.com/">SublimeText</a>. It is by far superior to <a href="http://notepad-plus-plus.org/">Notepad++</a>. There are some small things that I'm still working out, but I'm sure with time they'll go away. One of those things was the context menu was missing. I'm sure this was due to me using the portable installer, but it's a must for me to have! Doing a simple search on the web, I came across this gist that does exactly what I needed:<br />
<br />
<script src="https://gist.github.com/mrchief/5628677.js"></script>
Here's the code in its entirety... You just never know with the web. ;)<br />
<pre><code>
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause
</code>
</pre>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-83970089446459628762013-10-01T08:30:00.000-04:002013-10-01T08:30:04.005-04:00Simple[r] jQuery Content Filter<div dir="ltr" style="text-align: left;" trbidi="on">
A post titled: <a href="http://www.sharepointdoug.com/2013/09/simple-jquery-content-filter-for-office.html" target="_blank">Simple jQuery Content Filter for Office 365 Public Website</a> by <a class="g-profile" href="http://twitter.com/DougHemminger" target="_blank">Doug Hemminger</a> came by my twitter stream that caught my eye. A real quick win and all around goodness for everyone. Reading through, I noticed some things I could tidy up. So I asked him if he'd be okay if I re-factor the code that he blogged about and he said absolutely!<br />
<br />
<h3 style="text-align: left;">
UX</h3>
It's almost expected these days to be able to click the text next to a checkbox and have it just work. Doug is using <span> for the text, so changing this to use <label> and wrap the <input> is a real quick win.<br />
<br />
As I was writing this up, I also had another idea... Why not have all of the filters show no matter how far down you scroll? This is also a quick and easy win, so it's in there too.<br />
<br />
<h3 style="text-align: left;">
DRY</h3>
<div>
DO NOT REPEAT YOURSELF! </div>
<div>
I'm totally guilty of this, but I try to do my best every time. I checked the source of the page where the code was added and found:</div>
<div>
<pre><code> $(document).ready(function () {
function SPSToggleView() {
if (!$("#SPSBusinessCheckbox").prop("checked")) {
$(".SPSBusiness").hide();
} else {
$(".SPSBusiness").show();
}
if (!$("#SPSInformationWorkerCheckbox").prop("checked")) {
$(".SPSInformationWorker").hide();
} else {
$(".SPSInformationWorker").show();
}
if (!$("#SPSCertificationCheckbox").prop("checked")) {
$(".SPSCertification").hide();
} else {
$(".SPSCertification").show();
}
if (!$("#SPSBusinessIntelligenceCheckbox").prop("checked")) {
$(".SPSBusinessIntelligence").hide();
} else {
$(".SPSBusinessIntelligence").show();
}
if (!$("#SPSDeveloperCheckbox").prop("checked")) {
$(".SPSDeveloper").hide();
} else {
$(".SPSDeveloper").show();
}
if (!$("#SPSITProCheckbox").prop("checked")) {
$(".SPSITPro").hide();
} else {
$(".SPSITPro").show();
}
if (!$("#SPSCloudCheckbox").prop("checked")) {
$(".SPSCloud").hide();
} else {
$(".SPSCloud").show();
}
if (!$("#SPSSocialCheckbox").prop("checked")) {
$(".SPSSocial").hide();
} else {
$(".SPSSocial").show();
}
if (!$("#SPSGeneralCheckbox").prop("checked")) {
$(".SPSGeneral").hide();
} else {
$(".SPSGeneral").show();
}
};
$("#SPSInformationWorkerCheckbox").attr("checked", true);
$("#SPSBusinessCheckbox").attr("checked", true);
$("#SPSCertificationCheckbox").attr("checked", true);
$("#SPSBusinessIntelligenceCheckbox").attr("checked", true);
$("#SPSDeveloperCheckbox").attr("checked", true);
$("#SPSITProCheckbox").attr("checked", true);
$("#SPSCloudCheckbox").attr("checked", true);
$("#SPSSocialCheckbox").attr("checked", true);
$("#SPSGeneralCheckbox").attr("checked", true);
$("#SPSInformationWorkerCheckbox").click(SPSToggleView);
$("#SPSBusinessCheckbox").click(SPSToggleView);
$("#SPSCertificationCheckbox").click(SPSToggleView);
$("#SPSBusinessIntelligenceCheckbox").click(SPSToggleView);
$("#SPSDeveloperCheckbox").click(SPSToggleView);
$("#SPSITProCheckbox").click(SPSToggleView);
$("#SPSCloudCheckbox").click(SPSToggleView);
$("#SPSSocialCheckbox").click(SPSToggleView);
$("#SPSGeneralCheckbox").click(SPSToggleView);
});</code></pre>
<br />
<br />
Even though this is a simple solution, I knew it could be made simpler. :) I got it down to this:
<br />
<br />
<pre><code>
$(document).ready(function () {
var $wrapper = $("#wrapper");
$wrapper.on("change", "input[data-filter]", function (event) {
var $this = $(this),
filter = $this.data("filter");
$wrapper.find("div[data-filter='" + filter + "']").slideToggle();
});
});</code></pre>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The magic is done by hiding the value(s) we are going to hide/show directly onto the <input> as a `data-filter` attribute. When the change event is fired, that value is surfaced. Then a simple query of the DOM to find the correct <div>'s that this filter relates to. The <a href="http://jqapi.com/#p=slideToggle" target="_blank">jQuery#slideToggle</a> method knows whether or not the elements are hidden or displayed, so there's no need to check the state of the <input>.</div>
<div style="text-align: left;">
<br /></div>
<h3 style="text-align: left;">
Results</h3>
<div>
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="400" src="http://jsfiddle.net/iOnline247/SfbPM/embedded/result/" width="100%"></iframe></div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-56208307757515900782013-03-21T10:12:00.001-04:002013-03-21T10:12:20.587-04:00RowLimit and CAML Query<div dir="ltr" style="text-align: left;" trbidi="on">
I keep forgetting this, so here's a little note for me:<br />
<br />
<code>
</code>
<pre><code>"<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='Author'/><Value Type='Integer'><UserID/></Value></Eq></Where><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query><RowLimit>1</RowLimit></View>"</code></pre>
<span style="font-family: monospace;"><span style="white-space: pre;">
</span></span><br />
<div>
There you have it... A valid usage of RowLimit within a CAML Query.</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-73714381979117461122013-03-14T22:22:00.001-04:002013-03-15T01:12:38.584-04:00jQueryUI Autocomplete with SharePoint Drop Downs<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
SharePoint Drop Downs Suck!</h2>
<div>
I can't go anywhere without having this UX nightmare on my hands. How many times have you started typing in these drop downs, then tab away expecting the same UX you have,<b> LIKE EVERYWHERE ELSE ON THE INTERNET?</b> The problem is, these drop downs are inconsistent in their behavior and even render completely different in Internet Explorer. If there are 20+ items within the list, you can guarantee calls to your helpdesk. I've spent enough time working on this problem; enough to offer up some code so you can handle this yourself too. Hopefully, you find it useful.</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Search by Type UX</h3>
<div>
This has been blogged about a bunch... Consider this horse completely beaten and dead at this point, but nothing I've seen out there handles SharePoint drop downs the way I do with this code. Without further adieu, the codez:</div>
<div>
<br /></div>
<code>
</code>
<br />
<div>
<div>
<br />
<div style="background-color: #333333; color: #cccccc; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<code><link type="text/css" rel="stylesheet" href="//code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.min.css"></code></div>
<div style="background-color: #333333; color: #cccccc; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<br /></div>
<div style="background-color: #333333; color: #cccccc; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<code><script src="//code.jquery.com/jquery-1.8.3.min.js"></script></code></div>
<div style="background-color: #333333; color: #cccccc; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<code><script src="//code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script></code></div>
<div>
<br /></div>
</div>
<div>
<code><script></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>function getFormDDL( columnName ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>var $ddl = $("select[title='" + columnName + "']"),</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choices,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choiceArray,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>index = 1</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>; //local vars</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>if ( $ddl.length > 0 ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.SPOptions = $ddl.find("option").map(function() {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>var $el = $(this);</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>return {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>label: $el.text(),</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>id: $el.val()</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}; </code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}).get();</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.SPComplexDdl = false;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl = $("input[title='" + columnName + "']");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choices = $ddl.attr("choices");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choiceArray = choices.split("|");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.SPOptions = [];</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>for ( ; index < choiceArray.length; index = index + 2 ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.SPOptions.push({</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>label: choiceArray[ index - 1 ],</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>id: choiceArray[ index ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>});</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.SPComplexDdl = true;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>return $ddl;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>function setFormDdl( $ddl, lookupVal ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>var choices,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choiceArray,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>hiddenInput,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>index</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>;</code></div>
<div>
<code><br /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>if ( $ddl.SPComplexDdl ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choices = $ddl.attr("choices");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>hiddenInput = $ddl.attr("optHid");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$("input[id='" + hiddenInput + "']").val( lookupVal );</code></div>
<div>
<code><br /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>choiceArray = choices.split("|");</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>for ( index = 1; index < choiceArray.length; index = index + 2 ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>if ( choiceArray[ index ] == lookupVal ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.val( choiceArray[ index - 1 ] );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.val( lookupVal );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code>/*****</code></div>
<div>
<code>*</code></div>
<div>
<code>*<span class="Apple-tab-span" style="white-space: pre;"> </span>Main processing</code></div>
<div>
<code>*</code></div>
<div>
<code>******/</code></div>
<div>
<code><br /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$( document ).ready(function() {</code><br />
<code> // To use this, just add as many Display Names you want that are Drop Downs on your form!</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>var columnNames = [ "Full Name", "City" ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code><br />
<code><span class="Apple-tab-span" style="white-space: pre;"> // Don't touch... It works as is. :)</span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$.each( columnNames, function( index, columnName ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>var $ddl = getFormDDL( columnName ),</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$wrapper = $("<div class='sp-planet-autocomplete'>"),</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>idName = columnName.replace(/ /g, "-"),</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$input = $("<input class='ms-long' id='" + idName + "' />")</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>; //local vars</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>// debugger;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>// When ddl is complex, we need to hide the whole shebang. Might as well do it for a simple ddl too.</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.closest("span[dir='none']").hide();</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$wrapper.append( $input );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$ddl.closest("td").prepend( $wrapper );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>// Find autocomplete options here.</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>// http://jqueryui.com/autocomplete/</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$input.autocomplete({</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>source: $ddl.SPOptions,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>minLength: 0,</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>select: function( event, ui ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>setFormDdl( $ddl, ui.item.id );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>});</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></code><br />
<code><span class="Apple-tab-span" style="white-space: pre;"> // If selection is made and then text is deleted, this will prevent that. This ain't my first rodeo...</span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>$input.on("blur", function( el ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>// debugger;</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>if( el.currentTarget.value.trim() === "" ) {</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>setFormDdl( $ddl, 0 );</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>}</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>});</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span></code></div>
<div>
<code><br /></code></div>
<div>
<code></script></code></div>
</div>
<code>
</code>
<br />
<div>
<br /></div>
<h3 style="text-align: left;">
SharePoint Drop Downs = Search by Type Now!</h3>
<div>
Now this is a cool alternative to the standard ho-hum. It's safe to say that users know exactly what they are looking for when there are 20+ options to choose from. With that in mind, providing a search by type UX feels natural. Also as an added bonus, jQueryUI gives you: up and down keyboard navigation and enter/tab selection. Having this enabled just <b>FEELS </b>good!<br />
<br />
<h3 style="text-align: left;">
Search by Type Usage</h3>
</div>
<div>
The columNames variable is the only variable you have to change. Everything else is handled by jQuery/jQueryUI magic under the hood. The only caveat to my code is that it currently doesn't handle multiple selections. My current needs haven't forced me to pursue this, but if you find it necessary, I may revisit it. I'd be more inclined to do so, <b>*if*</b> it was profitable. :-)</div>
<div>
<br /></div>
<div>
Feel free to let me know how this code works out for you. It <b>*should*</b> just work.</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-40360524918454846752013-02-12T10:59:00.000-05:002013-02-13T20:19:35.950-05:00Setting field values using CSOM client side - Another look<div dir="ltr" style="text-align: left;" trbidi="on">
Last night after hitting publish, I enjoyed a long ride home on the metro... I was able to catch up on some of my reading. It's a relaxing part of my day and sometimes exciting because I get to grind away on concepts that I'm working on. Last night did not disappoint.<br />
<br />
<h3 style="text-align: left;">
spUtils - <code>setColumnVal</code></h3>
<div>
<code><br /></code></div>
<div>
As I said in the <a href="http://mattbramer.blogspot.com/2013/02/setting-field-values-using-csom-client.html">previous post</a>, I've already tackled this problem, however, I didn't really like the implementation. So, here's my bright idea... Toggle the library back to use <code><a href="https://github.com/iOnline247/spUtils/blob/master/spUtils.unmin.js#L549">setColumnVal</a></code> and see what the XML looks like under the hood. Doing just that, here's what's produced( I've snipped this for brevity ):<br />
<br /></div>
<code>
</code>
<br />
<div>
<div>
<code><Method Name="SetFieldValue" Id="26" ObjectPathId="21"></code><br />
<code> <Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Parameter Type="Array"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Object TypeId="{c956ab54-16bd-4c18-89d2-996f57282a6f}"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupValue" Type="String">DEV\Administrator</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupId" Type="Number">-1</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Object></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Object TypeId="{c956ab54-16bd-4c18-89d2-996f57282a6f}"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupValue" Type="String">DEV\spUser</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupId" Type="Number">-1</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Object></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Parameter></span></code><br />
<code><span class="Apple-tab-span" style="white-space: pre;"></Method></span></code></div>
</div>
<code>
</code>
<br />
<div>
<br />
So based on that, it's easy to see the people picker XML has to be an array of objects. Let's give that a shot now using this code mixed with <code>parseAndSetFieldValue</code>.<br />
<br />
<h3 style="text-align: left;">
spUtils - <span style="font-family: monospace;">parseAndSetFieldValue</span> revisited</h3>
<div>
<br /></div>
<span style="font-family: monospace;">spUtils.updateListItems({</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">listName: "spUtils",</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">updates : {</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">1 : {</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">"Title" : spUtils.isoDate(),</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">"AssignedTo" : [</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">{</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">LookupValue: "DEV\\Administrator",</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">LookupId: -1</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">},</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">{</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">LookupValue: "DEV\\spUser",</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">LookupId: -1</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">}</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">]</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">}</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">},</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">success: function( data, ctx ) {</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">debugger;</span><br />
<span class="Apple-tab-span" style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">}</span><br />
<span style="font-family: monospace;">});</span><br />
<span style="font-family: monospace;"><br /></span>
Using the code above produces this XML ( snipped as well for brevity ):<br />
<br /></div>
<div>
<div>
<code><Method Name="ParseAndSetFieldValue" Id="44" ObjectPathId="21"></code><br />
<code> <Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Parameter Type="Array"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Object Type="Dictionary"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupValue" Type="String">DEV\Administrator</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupId" Type="Number">-1</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Object></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Object Type="Dictionary"></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupValue" Type="String">DEV\spUser</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> <Property Name="LookupId" Type="Number">-1</Property></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Object></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </Parameter></span></code></div>
<div>
<code> </Parameters></code><br />
<code></Method></code></div>
<div>
<code><br /></code>
<br />
It's remarkably close to the XML that actually works. The only thing that is different is the Object Type. Sadly, this is all that it takes for this to <span style="color: red;">FAIL</span>. Yep, that's right... Trying to be smarter than the average bear, let's give it another shake. This time, I'm going to take some code out of the setColumnVal method and drop it into an array. Take a look at this:<br />
<br />
<code>
spUtils.updateListItems({<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listName: "spUtils",<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>updates : {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>1 : {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"Title" : spUtils.isoDate(),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"AssignedTo" : [ SP.FieldUserValue.fromUser("DEV\\Administrator"),<br /><span style="white-space: pre;"> </span>SP.FieldUserValue.fromUser("DEV\\spUser")<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>success: function( data, ctx ) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>debugger;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
});</code><br />
<br />
This in turn produces XML that *should* work!<br />
<br />
<code>
<Method Name="ParseAndSetFieldValue" Id="44" ObjectPathId="21"><br /><span style="white-space: pre;"> </span><Parameters><br /><span style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter><br /><span style="white-space: pre;"> </span><Parameter Type="Array"><br /><span style="white-space: pre;"> </span><Object TypeId="{c956ab54-16bd-4c18-89d2-996f57282a6f}"><br /><span style="white-space: pre;"> </span><Property Name="LookupValue" Type="String">DEV\Administrator</Property><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="LookupId" Type="Number">-1</Property><br /><span style="white-space: pre;"> </span></Object><br /><span style="white-space: pre;"> </span><Object TypeId="{c956ab54-16bd-4c18-89d2-996f57282a6f}"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="LookupValue" Type="String">DEV\spUser</Property><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="LookupId" Type="Number">-1</Property><br /><span style="white-space: pre;"> </span></Object><br /><span style="white-space: pre;"> </span></Parameter><br /><span style="white-space: pre;"> </span></Parameters><br />
</Method></code>
<br />
<div>
<br /></div>
The only difference this time is the Method Name attribute. Sadly, even this <span style="color: red;">FAILS! </span>I was going to continue with using numbers, but with this being a show stopper, I'm convinced I've researched this thoroughly enough. This may be different in <a href="http://mattbramer.blogspot.com/search/label/SP2013">SP2013</a>, it simply doesn't work in <a href="http://mattbramer.blogspot.com/search/label/SP2010">SP2010</a>, therefore unreliable.<br />
<br />
<h3 style="text-align: left;">
What's next?</h3>
</div>
</div>
<div>
<br /></div>
<div>
Since I need the context of the list item to set its values when using the .update() method, it's not feasible to change what I have currently. To set lookups and people picker values in <a href="http://mattbramer.blogspot.com/search/label/CSOM">CSOM</a>, you have to use the code I've already written. Guess it's time I start documenting the API, eh?</div>
<code>
</code>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-56566274512929981652013-02-11T16:00:00.002-05:002013-02-12T08:50:46.232-05:00Setting field values using CSOM client side<div dir="ltr" style="text-align: left;" trbidi="on">
A rather long time ago, I wrote some code to handle creation and updates of items when using Client Object Model. This bit of code works very well however it's always made me feel like the API I've built had warts. <a href="https://github.com/iOnline247/spUtils/blob/master/spUtils.unmin.js#L549" target="_blank">Take a look for yourself</a>. This method allows for anyone to modify Lookup values as well as People Picker values. Using this, you can also set multiple values without a problem. That's the good... The ugly is for this to work, it's necessary to tell <a href="http://mattbramer.blogspot.com/search/label/sputils">spUtils</a> the column type. This ended up looking something like this:<br />
<br />
<br />
<code>
/***************************************<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Test 26 ~ updateListItems - Updates item's lookup and people picker column<br />
***************************************/<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>spUtils.updateListItems({<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>listName : "Project Tasks",<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>updates : {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>111 : { // the key is the item ID<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"RelatedProject{L}" : spUtils.isoDate(),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"AssignedTo{P}" : 1,</code><br />
<code> "Title" : "Hello, World!"<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>success : function() { debugger; }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<br />
<br />
// End codez</code>
<br />
<br />
<span style="color: red;">Notice the appended characters that represent the column type.</span> This is fine but at the end of the day not very user friendly... I've always thought I could do better. This blog post will explore what I've found inside the <a href="http://msdn.microsoft.com/en-us/library/jj246996.aspx">SP Namespace</a> and what my options are to fix it.<br />
<br />
<h3 style="text-align: left;">
SP.Debug.js to the Rescue?</h3>
When looking at a listItem object in my debugger, I found a rather coy method. It literally screamed at me: "Put me in the game coach!"... Totally looked over this one when building CRUD into spUtils. With that said, I've made the change under the hood to use this method instead.<br />
<br />
<code>
parseAndSetFieldValue: function(fieldName, value_) {ULS5Vl:;<br />
this.get_fieldValues()[fieldName] = value_;<br />
var $v_0 = new SP.ClientActionInvokeMethod(this, 'ParseAndSetFieldValue', [ fieldName, value_ ]);<br />
if ((this.get_context())) {<br />
this.get_context().addQuery($v_0);<br />
}<br />
},
</code><br />
<br />
For posterity, here's the raw bits of the function call. Nothing too exciting here since it's really a wrapper for the <span style="font-family: monospace;">ClientActionInvokeMethod. </span>Come to think of it, what isn't a wrapper for <span style="font-family: monospace;">ClientActionInvokeMethod</span> inside SP.js?<br />
<br />
<h3 style="text-align: left;">
Is parseAndSetFieldValue really up to snuff?</h3>
<div>
For me it was truly a magical moment coming across this method. As of matter of fact, I made a note of it when I did to come back someday and put the spotlight directly on it... As of a result, here are my findings in raw format ( I've highlighted the important pieces of XML ):<br />
<br /></div>
<code>
</code>
<br />
<div>
<div>
<code><!-- Test 1</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", ["DEV\\Administrator", "DEV\\spuser"] ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using Array of strings</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:10:13Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Array"></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Object Type="String">DEV\Administrator</Object></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Object Type="String">DEV\spuser</Object></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="17" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">RelatedProject</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">2</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="18" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="19" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="RelatedProject" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Request failed. Invalid look-up value. A look-up field contains invalid data. Please check the value and try again. </code></div>
<div>
<code><br /></code></div>
<div>
<code><br /></code></div>
<div>
<code><!-- Test 2 </code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", "DEV\\Administrator, DEV\\spuser" ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using comma separated values inside a string.</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:16:15Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">DEV\Administrator; DEV\spuser</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Request failed. Invalid data has been used to update the list item. The field you are trying to update may be read only. </code></div>
<div>
<code><br /></code></div>
<div>
<code><!-- Test 3</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", "DEV\\Administrator;#DEV\\spuser" ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using the old semi-colon bang delimiter.</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:28:42Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">DEV\Administrator;#DEV\spuser</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Request failed. Invalid look-up value. A look-up field contains invalid data. Please check the value and try again. </code></div>
<div>
<code><br /></code></div>
<div>
<code><!-- Test 4 </code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", "DEV\\Administrator; DEV\\spuser" ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using text similar to typing into the control manually.</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:32:14Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">DEV\Administrator; DEV\spuser</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Request failed. Invalid data has been used to update the list item. The field you are trying to update may be read only. </code></div>
<div>
<code><br /></code></div>
<div>
<code><br /></code></div>
<div>
<code><!-- Test 5</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", 1 ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using a single user id. Works as a string as well.</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:37:00Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">1</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Holy shit! It works....</code></div>
<div>
<code><br /></code></div>
<div>
<code><br /></code></div>
<div>
<code><!-- Test 6</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>[ "AssignedTo", [ 1, 17 ] ]</code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span>XML sent to Server using an array of numbers.</code></div>
<div>
<code>--></code></div>
<div>
<code><br /></code></div>
<div>
<code><Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="11" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Title</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">2013-02-11T20:40:36Z</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="12" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="13" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="ParseAndSetFieldValue" Id="14" ObjectPathId="9"></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">AssignedTo</Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Array"></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Object Type="Number">17</Object></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span><Object Type="Number">1</Object></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameter></span></code></div>
<div>
<code><span style="color: red;"><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></span></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Name="Update" Id="15" ObjectPathId="9" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="16" ObjectPathId="9"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="AssignedTo" ScalarProperty="true" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Query></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">Project Tasks</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItemById"></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="Number">42</Parameter></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></Method></code></div>
<div>
<code><span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></code></div>
<div>
<code></Request></code></div>
<div>
<code><br /></code></div>
<div>
<code>Result:</code></div>
<div>
<code>Well, it doesn't fail... However the column is set to null.</code></div>
<div>
<code><br /></code></div>
</div>
<code>
</code>
<br />
<div>
</div>
Well that just sucks now doesn't it? Using that method, I can <b>ONLY </b>use the user ID <b>AND ONLY</b> one user ID. What a waste of time. The method should really be called: parseValuesAndWasteMatthewsTime(). <br />
<br />
<h3 style="text-align: left;">
What about GetList?</h3>
<div>
I could query the current site, cache all of the list information and then figure out the column types on the fly.</div>
<div>
While I know I could pull this off, I really don't think it's a great option. CSOM is asynchronous in nature, which means I'd have to nest everything <b>AFTER </b>the initial call to get the list information. That would be worse than what is already there...</div>
<div>
<br /></div>
<h3 style="text-align: left;">
What's next?</h3>
Since this inefficiency cannot be overcome in SP2010, I'm going to press on with the API I currently have because it simply works... I'll continue to look for better ways to do this, as this is primarily why I've never documented <a href="http://mattbramer.blogspot.com/search/label/sputils">spUtils</a>. I figured the API would change once I found a different way and didn't want to deal with the overhead of dealing with that.<br />
<br />
Well since I feel like I've given the SP Namespace a fair shake, it's time to clean up the code and start vetting it for usage within SP2013. Look for much more capabilities to be baked into this coming soon!<br />
<br />
Example: spUtils.startWorkflow(); // This will not use web services to accomplish this. I'm trying to rely on SP.js for everything.<br />
<br />
Happy coding!</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-58237174031404113522013-02-08T12:16:00.000-05:002013-02-10T23:56:35.434-05:00Debugging CSOM (Client Object Model) Client-Side<div dir="ltr" style="text-align: left;" trbidi="on">
If you didn't get the pleasure of attending <a href="http://twitter.com/xenoxg" rel="nofollow">@xenoxg</a>'s <a href="http://www.meetup.com/fedspug-wspdc/events/82976212/">session</a> at the <a href="http://www.fedspug.org/">FEDSPUG</a> last night, you definitely missed some very noteworthy information. Definitely check it out if you can...<br />
<br />
Xenox asked a simple question last night: How many people in the room use <a href="http://www.fiddler2.com/fiddler2/version.asp">Fiddler</a>?<br />
I quickly raised my hand because I have used this many times as well as many other people in the room.<br />
<br />
After he showed us the network traffic that was produced from his application, I thought to myself: When was the last time I used Fiddler? I couldn't answer that question... I've used this amazing tool, but for some reason I didn't know the last time I actually used it. The main reason for this is because I live in browsers every waking moment... The tooling has become quite good on the front-end of the house and I've actually replaced my need of Fiddler with the tools baked into them.<br />
<br />
<b>Behold!</b><br />
<h3 style="text-align: left;">
Internet Explorer Developer Tools: Network</h3>
<h4 style="text-align: left;">
Setup a Network Capture</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheEgvREPHxMYysMe354aQ-l4hnbqpsGSyEgEZrTDU8pECK5F7fizjQ2_9_LYLs18swWRkTWrIR6NhzShijRLg4AgLUgmnpmXo_NK3mlfVD4p8QhmkfcZsnXzSvIhvu3s2PQrCu-WQKlsMz/s1600/IEDevNetworkTab.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="IE Dev Tools Network Tab" border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheEgvREPHxMYysMe354aQ-l4hnbqpsGSyEgEZrTDU8pECK5F7fizjQ2_9_LYLs18swWRkTWrIR6NhzShijRLg4AgLUgmnpmXo_NK3mlfVD4p8QhmkfcZsnXzSvIhvu3s2PQrCu-WQKlsMz/s640/IEDevNetworkTab.png" title="IE Dev Tools Network Tab" width="640" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheEgvREPHxMYysMe354aQ-l4hnbqpsGSyEgEZrTDU8pECK5F7fizjQ2_9_LYLs18swWRkTWrIR6NhzShijRLg4AgLUgmnpmXo_NK3mlfVD4p8QhmkfcZsnXzSvIhvu3s2PQrCu-WQKlsMz/s1600/IEDevNetworkTab.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<div style="text-align: left;">
If you are unfamiliar with the developer tools, just press F12 when you have IE open. If you have IE9+ (as you should!), you'll see the lovely Network tab. It's extremely simple to use and gives me all the info that I need. All you have to do is press the "Start Capturing" button and then render your page. Here's an example of the types of information you'll typically see.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXQSCyDeFjVNxKNBKCbI9HW1mBXNxPAB864ummp6pkmmz-yHGtvwF-O1gHUpy4vvlMzFiRafwg45OTxJxv-9yc_8wMLqinpuobQiGmO_lNPs51fyLp55Op5Bf9-gJqSS_X4QrKr2GykEYJ/s1600/IEDevNetworkTabDetails.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXQSCyDeFjVNxKNBKCbI9HW1mBXNxPAB864ummp6pkmmz-yHGtvwF-O1gHUpy4vvlMzFiRafwg45OTxJxv-9yc_8wMLqinpuobQiGmO_lNPs51fyLp55Op5Bf9-gJqSS_X4QrKr2GykEYJ/s400/IEDevNetworkTabDetails.png" width="400" /></a></div>
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Since this is a post about <a href="http://msdn.microsoft.com/en-us/library/fp179912.aspx">CSOM</a>, the relevant line to us is already highlighted. Notice the Javascript makes a call to http://pathToServer/_vti_bin/client.svc/ProcessQuery. Once you've found this in the captured network traffic, you simply highlight that particular line and click "Go to detailed view". This button is located directly underneath the Network tab.</div>
<h4 style="text-align: left;">
Viewing the Server Response</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi57nZ7sL3TwyI4S-rsWa9w_wA_q7BAPJbnXezugXHFviL0ZxpXpH9ahP-7ljJaa2AsQW6H7LuANSKBEv0aGw780tYnF5G4SgEhWNJrYLa0cVSs0F05VwZR7_t13oit4MdNEyACsm6YMfAK/s1600/IEDevNetworkTabResults.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="204" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi57nZ7sL3TwyI4S-rsWa9w_wA_q7BAPJbnXezugXHFviL0ZxpXpH9ahP-7ljJaa2AsQW6H7LuANSKBEv0aGw780tYnF5G4SgEhWNJrYLa0cVSs0F05VwZR7_t13oit4MdNEyACsm6YMfAK/s640/IEDevNetworkTabResults.png" width="640" /></a></div>
<div>
<br /></div>
<div>
I'm not going to pretend to know all of what this stuff means, but it is nice to look through it and learn more about how this all is glued together for us. The two tabs here that I use the most are "Request Body" and "Response Body". If you are big into the now deprecated web services, you can think of the "Request Body" as your SOAP envelope. In fact under the hood, it's actually still sending XML to the server:</div>
<div>
<br />
<!-- START CODEZ --></div>
<div>
<div>
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="14.0.0.0" LibraryVersion="14.0.4762.1000" ApplicationName="Javascript Library"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Actions></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="1" ObjectPathId="0" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="3" ObjectPathId="2" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="5" ObjectPathId="4" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="7" ObjectPathId="6" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectIdentityQuery Id="8" ObjectPathId="6" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPath Id="10" ObjectPathId="9" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Query Id="11" ObjectPathId="9"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Query SelectAllProperties="false"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Properties /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Query></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ChildItemQuery SelectAllProperties="false"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Properties></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="ID" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="FileRef" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="FSObjType" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="FolderChildCount" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="ItemChildCount" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Title" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Something01" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Something02" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="Something03" SelectAll="true" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Properties></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></ChildItemQuery></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Query></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Actions></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><ObjectPaths></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="2" ParentId="0" Name="Web" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Id="4" ParentId="2" Name="Lists" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="6" ParentId="4" Name="GetByTitle"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter Type="String">My List Name</Parameter></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Method></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Method Id="9" ParentId="6" Name="GetItems"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Parameters></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Parameter TypeId="{3d248d7b-fc86-40a3-aa97-02a75d69fb8a}"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="FolderServerRelativeUrl" Type="String">/Lists/SomeListName</Property></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="DatesInUtc" Type="Boolean">true</Property></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="ViewXml" Type="String">&lt;View&gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name='Something03' Ascending='True' /&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;/View&gt;</Property></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><Property Name="ListItemCollectionPosition" Type="Null" /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Parameter></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Parameters></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></Method></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></ObjectPaths></div>
<div>
</Request></div>
</div>
<div>
<!-- END CODEZ --></div>
<div>
<br /></div>
<div>
The "Response Body" comes to us in the form of JSON:<br />
<br />
// START CODEZ</div>
<div>
<div>
[</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"SchemaVersion":"14.0.0.0","LibraryVersion":"14.0.4762.1000","ErrorInfo":null</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>1,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"IsNull":false</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>3,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"IsNull":false</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>5,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"IsNull":false</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>7,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"IsNull":false</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>8,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_ObjectIdentity_":"740c6a0b-85e2-48a0-a494-e0f1759d4aa7:web:90a9005d-7dcd-4784-9ed0-b4f722941dc0:list:f832844d-5ed1-4e39-98f3-d39f5e37ea3b"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>10,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"IsNull":false</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>11,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_ObjectType_" : "SP.ListItemCollection",</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_Child_Items_":<span class="Apple-tab-span" style="white-space: pre;"> </span>[</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_ObjectType_":"SP.ListItem","_ObjectIdentity_":"740c6a0b-85e2-48a0-a494-e0f1759d4aa7:web:90a9005d-7dcd-4784-9ed0-b4f722941dc0:list:f832844d-5ed1-4e39-98f3-d39f5e37ea3b:item:43,1","_ObjectVersion_":"3","ID":43,"FileRef":"\u002fLists\u002fSomethingNav\u002fTest3","FSObjType":"1","FolderChildCount":"5","ItemChildCount":"0","Title":"Test3","Something01":null,"Something02":null,"Something03":1</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_ObjectType_":"SP.ListItem","_ObjectIdentity_":"740c6a0b-85e2-48a0-a494-e0f1759d4aa7:web:90a9005d-7dcd-4784-9ed0-b4f722941dc0:list:f832844d-5ed1-4e39-98f3-d39f5e37ea3b:item:1,1","_ObjectVersion_":"3","ID":1,"FileRef":"\u002fLists\u002fSomethingNav\u002fTest","FSObjType":"1","FolderChildCount":"4","ItemChildCount":"0","Title":"Test","Something01":null,"Something02":null,"Something03":2</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>},</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>"_ObjectType_":"SP.ListItem","_ObjectIdentity_":"740c6a0b-85e2-48a0-a494-e0f1759d4aa7:web:90a9005d-7dcd-4784-9ed0-b4f722941dc0:list:f832844d-5ed1-4e39-98f3-d39f5e37ea3b:item:22,1","_ObjectVersion_":"3","ID":22,"FileRef":"\u002fLists\u002fSomethingNav\u002fTest2","FSObjType":"1","FolderChildCount":"5","ItemChildCount":"0","Title":"Test2","Something01":null,"Something02":null,"Something03":3</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>]</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
// END CODEZ</div>
</div>
<h4 style="text-align: left;">
Making Sense of it All</h4>
<div>
Let's get one thing clear, if you can make sense of this "Response Body" and why it's formulated the way that is it, you deserve a raise. This portion of JSON that starts to make sense is directly after the 11. Knowing what your JSON looks like can make it real easy to not only debug your scripts, but also definitively prove your script is communicating with the server correctly. With this at your fingertips, there's no real need for me to use another piece of software. And that's why I couldn't remember the last time I used Fiddler. My browser(s) do everything I was using Fiddler for. I'm definitely not saying it's a replacement, however for my needs, the browser suffices. </div>
<div>
<br /></div>
<div>
Happy coding!</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-74618077027396502162012-11-29T10:01:00.001-05:002013-02-23T12:31:05.234-05:00Binding Event Handlers to SharePoint Content Types (Sandbox) <div dir="ltr" style="text-align: left;" trbidi="on">
Fiddling around in SharePoint's Sandbox land can and will test your sanity. There are things that are the way they are and you just have to deal with it. All in all, a learning experience indeed...<br />
<br />
Here's some key takeaways from my current project:<br />
<ul style="text-align: left;">
<li>You cannot add an Event Handler to a Content Type using C# in Sandbox mode</li>
<li>You <b>*can*</b> declaratively add the Event Handler to your Content Type!</li>
<ul>
<li><a href="http://malcan.com/EN/Lists/Tips%20and%20tricks/DispForm.aspx?ID=26">http://malcan.com/EN/Lists/Tips%20and%20tricks/DispForm.aspx?ID=26</a></li>
</ul>
<li>You <b>*can*</b> declaratively add the Event Handler to your list!</li>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ff398052.aspx">http://msdn.microsoft.com/en-us/library/ff398052.aspx</a></li>
</ul>
</ul>
<div>
<div style="text-align: left;">
I opted not to bind this to the Content Type because I didn't want the Event Handler's behavior to persist on any other list. I doubt the CT will be reused, but if it is, I know my code will not run erroneously<span style="color: #333333; font-family: verdana; font-size: x-small;">.</span></div>
<br />
Once that is added to your list, then you can dive into the properties and detect the Content Type GUID for the item that was just added. A simple example:</div>
<div>
<br /></div>
<pre><div>
<div>
public override void ItemAdded(SPItemEventProperties properties)
</div>
<div>
{</div>
<div>
base.ItemAdded(properties);</div>
<div>
</div>
<div>
if (properties.ListItem.ContentTypeId.Parent.ToString().ToUpper() == Constants.ctGuid.ToUpper())</div>
<div>
{</div>
<div>
// Snipped</div>
</div>
<div>
}</div>
<div>
</div>
</pre>
<div>
This is only a small part of what I'm in the middle of building. Hopefully, I can abstract more out and show off some of the innards.<br />
<br />
Cheers!<br />
<br />
<span style="color: red;">***Update***</span><br />
Shortly after posting this <a href="http://twitter.com/SharePointAlex">@SharePointAlex</a> and I <a href="https://twitter.com/iOnline247/status/274166701527007232">started to discuss binding Event Handlers to lists</a>. Based on my tests, I've confirmed that using a Site-scoped solution does in fact fire the Event Handler on all lists in your web. Using the same technique but having the solution Web-scoped will only bind the Event Handler to the list you declare. Thanks Alex for making dig a bit deeper to further get better documentation.</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-27818219358982693432012-11-26T12:14:00.000-05:002012-11-27T09:03:48.539-05:00CEWP Usage in SharePoint<div dir="ltr" style="text-align: left;" trbidi="on">
While I absolutely loathe the term "Best Practices", it's time to dive into a topic that really hasn't been talked about but should have by now. I'm *not* going to label this post as a "Best Practice", although I'd like to, but label it more like: this is what I do and why...<br />
<br />
<h3 style="text-align: left;">
Adding Script to Pages</h3>
<div>
It's well known that most of the front-end developers favor using CEWP's to inject script into our pages. Many <a href="http://usermanagedsolutions.com/SharePoint-User-Toolkit/default.aspx">well known webparts</a> use this technique. This is <b>great</b>! We can add functionality to my pages with a small amount of work and without using SharePoint Designer.</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Page Weight</h3>
<div>
What happens when you add scripts to your page using a CEWP? This is a very much a misnomer because you really aren't adding scripts and instead are adding HTML. CEWP's only interpret HTML and as such, they <b>DO NOT</b> cache any of the HTML added to the page. To take advantage of caching these resources, you must use write the HTML correctly. Adding <script> tags with a src attribute will tell the browser to cache your JavaScript files. If you avoid doing this, your HTML will have to be sent to your browser each time, causing your page to load slower than it really has to. Using a script tag correctly to call your .js file, your script will be cached by the browser and will not have to be downloaded for each page load.</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Considerations</h3>
<div>
Reading over an <a href="http://calendar.perfplanet.com/2011/why-inlining-everything-is-not-the-answer/">excellent write up about page weight</a> got me to thinking about what I've seen blogged in the SharePoint space. Most solutions have you connect a pseudo .js file to a CEWP. In actuality, this isn't a JavaScript file at all. It's a file that contains HTML. So that's quite confusing, not to mention, adds to your page weight. The post linked above says to keep your inlined CSS or JavaScript to < 1 ~ 4 KB. </div>
<div>
<br /></div>
<div>
Here's my list of considerations when adding a new CEWP to my page.</div>
<div>
<ul style="text-align: left;">
<li>What will this script potentially do over the life of this application?</li>
<li>Do I think this could grow over 1 KB?</li>
<li>Does the page weight even matter for this application?</li>
<li>Will I gain anything by caching these resources?</li>
</ul>
<h3 style="text-align: left;">
What I Do</h3>
</div>
<div>
Mostly, I create a .html file wherever I store my assets. I write <b>HTML </b>in that file. Generally speaking it's <link> tags and <script> tags that reference my resources. Doing so, will allow these files to be cached by the browser. Page weight and load times are very important to me, so this is generally what I do. However, I will write CSS and JavaScript in my .html file if I know there will be a very small amount of HTML going into that file.</div>
<div>
<br /></div>
<div>
Using this technique, I feel less confused overall. When I open a .js file, I'm actually looking at JavaScript and not CSS or HTML or both. Maybe it'll do the same for you, who knows?!? </div>
<div>
<br /></div>
<div>
This is what I do though.</div>
</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-23263598363019390022012-09-13T09:18:00.003-04:002012-09-13T09:19:45.153-04:00Query Strings Found on SharePoint's List Forms<div dir="ltr" style="text-align: left;" trbidi="on">
I love looking for an easier way and this time I've found one that previously worked just a bit weird before...<br />
<br />
The issue I've had is when creating items in a particular folder within a list, you have to be very conscious of the BaseName. It MUST be unique within your whole list structure or else the save fails. Look at the <a href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx#7">comments in the documentation</a> for more details.<br />
<br />
I've been building a tree navigation and I've been developing a way to insert folders/items dynamically. I just found an easier way to create folders wherever I need them to appear in the list. I no longer have to worry about the BaseName as SharePoint takes care of that for me. As I learn of more query strings, I'll append them to this post<br />
<br />
<h3 style="text-align: left;">
Query Strings </h3>
<b>RootFolder</b>=%2FSPDev%2FLists%2FLinkNav%2FmahFolder - Used to control the destination of where your new item will be saved.<br />
<br />
<b>Type</b>=0 - Used to tell SharePoint whether you want a folder or an item. 0 = folder; 1 = item.<br />
<br />
<b>ContentTypeId</b>=0x01040004B13BF0D61E0D44A7D0327C51C01D8A - Create the content type of your choice.<br />
<br />
<b>IsDlg</b>=1 - This query string can be set to anything and will behave as if the form is in a modal. Sometimes this can cause issues because saves/cancels rely on <b>window.frameElement </b>and if the <iframe> isn't present, the form will not work properly.<br />
<br />
That's all for now but I'm sure I'll find some more...</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-42512729141810117922012-08-28T17:30:00.000-04:002012-08-29T00:37:34.870-04:00From the depths of SharePoint's sp.js Pt. 2<div dir="ltr" style="text-align: left;" trbidi="on">
So I lied... :) The function found below is a part of core.js.<br />
<br />
A good ol' fashioned<br />
<pre>console.dir( GetCurrentCtx().clvp );</pre>
generates this bit of awesome:<br />
<br />
<pre>{
<span class="Apple-tab-span" style="white-space: pre;"> </span>ctx : [object Object],
<span class="Apple-tab-span" style="white-space: pre;"> </span>tab : [object],
<span class="Apple-tab-span" style="white-space: pre;"> </span>pagingTab : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>tBody : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>wpq : "WebPartWPQ4",
<span class="Apple-tab-span" style="white-space: pre;"> </span>inplUrl : "http://portal/SPDev/_layouts/inplview.aspx?List={49AFC299-FC30-4EE9-9571-50B3B366969E}&View={876230CC-BE1A-4845-8998-652BB77C891C}&ViewCount=7&ListViewPageUrl=http://portal/SPDev/pages/spUtils.aspx&IsXslView=TRUE",
<span class="Apple-tab-span" style="white-space: pre;"> </span>trEmpty : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootFolder : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>rootFolderGuid : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>rgpag : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>wpid : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>isEditing : false,
<span class="Apple-tab-span" style="white-space: pre;"> </span>dsrc : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>isInserting : false,
<span class="Apple-tab-span" style="white-space: pre;"> </span>strGroupName : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>strGroupCache : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>bRequestOutstanding : false,
<span class="Apple-tab-span" style="white-space: pre;"> </span>isEcbInfo : false,
<span class="Apple-tab-span" style="white-space: pre;"> </span>queueEcbInfo : ,
<span class="Apple-tab-span" style="white-space: pre;"> </span>fnEcbCallback : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>rgpaging : ,
<span class="Apple-tab-span" style="white-space: pre;"> </span>focusInfo : null,
<span class="Apple-tab-span" style="white-space: pre;"> </span>CUIItemInfo : [object Object],
<span class="Apple-tab-span" style="white-space: pre;"> </span>Init : function CLVPInit(){ULSiIp:;var f=this.ctx.listBaseType==1,d;if(this.ctx.listTemplate=="109"){this.ctx.clvp=null;return}d=this.ctx.listName+"-"+this.ctx.view;var b=GetElementsByName(d);if(b.length==0&&f){d="onetidDoclibViewTbl0";b=GetElementsByName(d)}va,
<span class="Apple-tab-span" style="white-space: pre;"> </span>RestoreNavigation : function CLVPRestoreNavigation(){ULSiIp:;var a=window.location.hash,c=this.InplViewUrl(),b=this.RefreshCurrent(true);b=b.substr(c.length+1);if(a.indexOf("InplviewHash=")==1){a=DecodeHashAsQueryString(a);var d=a.substr(14,38);if(d!=this.ctx.view)return;a=,
<span class="Apple-tab-span" style="white-space: pre;"> </span>FindWebPartDiv : function CLVPFindWebPartDiv(b){ULSiIp:;var a=b;while(a!=null&&a.tagName!="DIV")a=a.parentNode;return a},
<span class="Apple-tab-span" style="white-space: pre;"> </span>SyncPagingTables : function CLVPSyncPagingTables(){ULSiIp:;var b=this.pagingTab,a=document.getElementById("topPagingCell"+this.wpq.substr(7));if(b==null){if(a!=null)a.style.display="none";return}if(a!=null){a.style.display="";if(GetInnerText(a)!=GetInnerText(b))a.innerHTML,
<span class="Apple-tab-span" style="white-space: pre;"> </span>RehookPaging : function CLVPRehookPaging(){ULSiIp:;if(typeof this.ctx.noAJAX!="undefined"&&this.ctx.noAJAX)return;var tab=this.pagingTab;if(tab==null){this.SyncPagingTables();return}for(var lnks=tab.getElementsByTagName("A"),i=0;i<lnks.length;i++){var lnk=lnks[i],str=",
<span class="Apple-tab-span" style="white-space: pre;"> </span>FilterString : function CLVPFilterString(){ULSiIp:;if(this.rgpaging==null)return null;var a,d,b=[],c=true;for(a in this.rgpaging)if(a.indexOf("Filter")==0||a.indexOf("Sort")==0){if(c)c=false;else b.push("&");b.push(a);b.push("=");b.push(this.rgpaging[a])}return b.join(,
<span class="Apple-tab-span" style="white-space: pre;"> </span>RefreshPaging : function CLVPRefreshPaging(c,a,b){ULSiIp:;if(a!=null)this.tBody=document.getElementById(a);var d=this.isEditing?"JsGrid":null;return this.RefreshPagingEx(c,true,d,b)},
<span class="Apple-tab-span" style="white-space: pre;"> </span>RefreshPagingEx : function CLVPRefreshPagingEx(e,q,p,t){ULSiIp:;var s=GetUrlKeyValue("PageFirstRow",false,e)=="1";if(s)e=RemoveOnlyPagingArgs(e);var v=new CUrl(e),h=v.query;if(h.length>0)h=h.substr(1);var i=h.split("&"),f,a=[];if(p!=null)a.push("&Cmd="+p);else this.isEdit,
<span class="Apple-tab-span" style="white-space: pre;"> </span>ResetSelection : function CLVPResetSelection(){ULSiIp:;var a=this.ctx,f=true;this.CUIItemInfo=null;if(CountSelectedItems(a)>0){var h=a.dictSel;a.dictSel=[];a.CurrentSelectedItems=0;var g=window.location.href;if(g.indexOf("Filter")==-1&&g.indexOf("Sort")==-1){var d=this.t,
<span class="Apple-tab-span" style="white-space: pre;"> </span>WebPartId : function CLVPWebPartId(){ULSiIp:;if(this.wpid==null){if(this.tab!=null){var a=this.tab;a=GetAncestor(a,"DIV");if(a!=null){if(a.getAttribute("WebPartID2")!=null){this.wpid=a.getAttribute("WebPartID2");return this.wpid}if(a.getAttribute("WebPartID")!=null),
<span class="Apple-tab-span" style="white-space: pre;"> </span>RefreshCore : function CLVPRefreshCore(strUrl){ULSiIp:;MenuHtc_hide();var req;if(window.XMLHttpRequest)req=new XMLHttpRequest;else req=new ActiveXObject("Microsoft.XMLHTTP");var additionalPostData="";if(typeof this.ctx.overrideSelectCommand!="undefined"){additionalPos,
<span class="Apple-tab-span" style="white-space: pre;"> </span>RefreshCurrent : function CLVPRefreshCurrent(){ULSiIp:;var a=document.URL;STSNavigate(a)},
<span class="Apple-tab-span" style="white-space: pre;"> </span>GetQueryString : function CLVPGetQueryString(){ULSiIp:;if(this.tab!=null&&this.tab.getAttribute("FilterLink")!=null)return this.tab.getAttribute("FilterLink");else return document.URL},
<span class="Apple-tab-span" style="white-space: pre;"> </span>RefreshEcbInfo : function CLVPRefreshEcbInfo(b){ULSiIp:;var a=this.GetQueryString();a=FixUrlFromClvp2(this,a,false);this.isEcbInfo=true;this.strGroupName=b;var c=this;this.RefreshPagingEx(a,false,"EcbView")},
<span class="Apple-tab-span" style="white-space: pre;"> </span>CacheEcbInfo : function CLVPCacheEcbInfo(b){ULSiIp:;if(this.ctx.HasRelatedCascadeLists==1&&this.ctx.CascadeDeleteWarningMessage==null){var j="<CascadeDeleteWarningMessage>",k="</CascadeDeleteWarningMessage>";if(b.startsWith(j)){var g=b.indexOf(k);if(g!==-1){this.ctx.Ca,
<span class="Apple-tab-span" style="white-space: pre;"> </span>EnsureEcbInfo : function CLVPEnsureEcbInfo(c,f,a){ULSiIp:;var g="ecbtab_ctx"+this.ctx.ctxId,b=document.getElementById(g);if(b==null&&this.tab!=null&&this.tab.parentNode==null)for(var d=0;d<this.tab.childNodes.length;d++){var e=this.tab.childNodes[d];if(e.id==g)b=e}if(b&,
<span class="Apple-tab-span" style="white-space: pre;"> </span>InvalidateEcbInfo : function CLVPInvalidateEcbInfo(){ULSiIp:;var b="ecbtab_ctx"+this.ctx.ctxId,a=document.getElementById(b);if(a!=null){this.tab.removeChild(a);this.DeleteGroupNameCache()}},
<span class="Apple-tab-span" style="white-space: pre;"> </span>GetEcbInfo : function CLVPGetEcbInfo(b){ULSiIp:;var a=this.EnsureEcbInfo();if(a!=null)if(a.dict!=null)return a.dict[b];return null},
<span class="Apple-tab-span" style="white-space: pre;"> </span>SwitchToEdit : function CLVPSwitchToEdit(){ULSiIp:;var a=document.URL;a=FixUrlFromClvp2(this,a,false);this.RefreshPagingEx(a,false,"JsGrid")},
<span class="Apple-tab-span" style="white-space: pre;"> </span>EnsureChangeContext : function CLVPEnsureChangeContext(){ULSiIp:;if(this.cctx==null)this.cctx=new SP.ClientContext(null)},
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeleteItemCore : function CLVPDeleteItemCore(c,f){ULSiIp:;var h=this.ctx.listBaseType==1;this.EnsureChangeContext();var a=null;if(typeof this.rgehs=="undefined")this.rgehs=[];var b,e;b=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(b);e=b.startScope();this.cctx,
<span class="Apple-tab-span" style="white-space: pre;"> </span>CheckoutItem : function CLVPCheckoutItem(f,d){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var a,c,b=null;if(d!=0)return;a=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(a);c=a.startScope();b=this.cctx.get_web().get_lists,
<span class="Apple-tab-span" style="white-space: pre;"> </span>DiscardCheckoutItem : function CLVPDiscardCheckoutItem(e,g){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var b=null,a,f;if(g!=0)return;a=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(a);f=a.startScope();b=this.cctx.get_web().ge,
<span class="Apple-tab-span" style="white-space: pre;"> </span>CheckinItem : function CLVPCheckinItem(g,j,a){ULSiIp:;this.EnsureChangeContext();if(typeof this.rgehs=="undefined")this.rgehs=[];var c=null,b,h;if(j!=0)return;b=new SP.ExceptionHandlingScope(this.cctx);this.rgehs.push(b);h=b.startScope();c=this.cctx.get_web().get_list,
<span class="Apple-tab-span" style="white-space: pre;"> </span>ManageCopies : function CLVPManageCopies(f,e){ULSiIp:;if(e!=0)return;var b=this.GetEcbInfo(f);if(b!=null&&b.getAttribute("Url")!=null){var d=this.ctx.HttpRoot+"/_layouts/managecopies.aspx?ItemUrl="+b.getAttribute("Url")+"&Source="+GetSource(),a=window["ctx"+this.ctx.ct,
<span class="Apple-tab-span" style="white-space: pre;"> </span>ShowErrorDialog : function CLVPShowErrorDialog(g){ULSiIp:;var i,a=[],d=null,c=false;for(i in this.rgehs){var b=this.rgehs[i];if(b.get_hasException()){var f="s4-dlg-err-itm";if(!c){f="s4-dlg-err-firstitm";c=true;a.push(SP.Res.dlgTitleError)}var k=b.get_errorMessage();a.pus,
<span class="Apple-tab-span" style="white-space: pre;"> </span>InplViewUrl : function CLVPInplViewUrl(){ULSiIp:;if(this.inplUrl!=null)return this.inplUrl;var a=[],b=escapeUrlForCallback(this.ctx.HttpRoot);a.push(b);b[b.length-1]!="/"&&a.push("/");a.push("_layouts/inplview.aspx?List=");a.push(this.ctx.listName);if(this.ctx.view!=n,
<span class="Apple-tab-span" style="white-space: pre;"> </span>InplViewUrlTrim : function CLVPInplViewUrlTrim(a){ULSiIp:;var b="";if(a)if(typeof this.ctx.overrideFilterQstring!="undefined")b=a.substr(this.InplViewUrl().length-this.ctx.overrideFilterQstring.length);else b=a.substr(this.InplViewUrl().length+1);return b},
<span class="Apple-tab-span" style="white-space: pre;"> </span>ShowPopup : function CLVPShowPopup(a){ULSiIp:;MenuHtc_hide();if(typeof this.fnOnCommitPopup!="undefined"&&this.fnOnCommitPopup!=null)OpenPopUpPage(a,this.fnOnCommitPopup);else OpenPopUpPage(a,RefreshPage);return false},
<span class="Apple-tab-span" style="white-space: pre;"> </span>ValidateField : function CLVPValidateField(e,d,a,b){ULSiIp:;var c=this.FieldCommand("FldValidate",e,d,a,b),f={callback:a,newval:b,strCmd:c};if(this.qvalidate==null)this.qvalidate=[];this.qvalidate.push(f);if(!this.isValidating){this.isValidating=true;this.RefreshCore(c),
<span class="Apple-tab-span" style="white-space: pre;"> </span>FieldCommand : function CLVPFieldCommand(j,h,d,m,f){ULSiIp:;var a=[];a.push(this.InplViewUrl());a.push("&Cmd=");a.push(j);a.push("&Field=");a.push(d);a.push("&FieldValue=");var b=h.GetProp(d),c,n=this.gridParam.tableViewParams.columns.GetColumnByKey(d),k=jsGridParams.t,
<span class="Apple-tab-span" style="white-space: pre;"> </span>IsInGroupCache : function CLVPIsInGroupCache(a){ULSiIp:;if(this.strGroupCache==null)return false;return this.strGroupCache.indexOf(a+"$")!=-1},
<span class="Apple-tab-span" style="white-space: pre;"> </span>CacheGroupName : function CLVPCacheGroupName(a){ULSiIp:;if(this.strGroupCache==null)this.strGroupCache=a+"$";else this.strGroupCache=this.strGroupCache+a+"$"},
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeleteGroupNameCache : function CLVPDeleteGroupNameCache(){ULSiIp:;if(this.strGroupCache==null)return;var b=0,a;a=this.strGroupCache.indexOf("$",b);while(a!=-1){var d=this.strGroupCache.substring(b,a),e="ecbtab_ctx"+this.ctx.ctxId+"_"+d,c=document.getElementById(e);c&&this.tab,
<span class="Apple-tab-span" style="white-space: pre;"> </span>EnqueueEcbInfoRequest : function CLVPEnqueueEcbInfoRequest(b){ULSiIp:;for(var a=0;a<this.queueEcbInfo.length;a++)if(this.queueEcbInfo[a]==b)return;this.queueEcbInfo.push(b)},
<span class="Apple-tab-span" style="white-space: pre;"> </span>NoOutstandingECBRequests : function CLVPNoOutstandingECBRequests(){ULSiIp:;if(this.isEcbInfo)return false;if(this.queueEcbInfo.length>0)return false;return true}
}</pre>
<br />
That makes a bunch of noise, however, you'll see an interesting URL at the property named: <b>inplUrl. </b><br />
Upon visiting this URL, you'll see all of your data for that particular view. This seems very attractive for AJAX applications in SharePoint. Look for more to come in regards to this...<br />
<br />
Cheers,<br />
Matthew</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-6933847159904991102012-07-24T13:50:00.000-04:002012-07-26T08:48:30.893-04:00From the depths of SharePoint's sp.js Pt. 1<div dir="ltr" style="text-align: left;" trbidi="on">
<Part 1><br />
<br />
Crack open your favorite browser tools and run:<br />
<br />
<pre>ExecuteOrDelayUntilScriptLoaded( function() { console.dir( SP.Res ); }, 'sp.js');</pre>
<br />
The results will be:<br />
<br />
<pre>LOG: {
<span class="Apple-tab-span" style="white-space: pre;"> </span>lcid : "1033",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteAccessibleMenuName : "Autocomplete Menu",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteLoading : "Loading...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteListNotFound : "List Not Found.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteListTooLarge : "List is too large to support Autocomplete.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteNoResults : "Item does not exist.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteTooManyResults : "Enter more of the name to see suggestions.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteList : "List:",
<span class="Apple-tab-span" style="white-space: pre;"> </span>autocompleteView : "View:",
<span class="Apple-tab-span" style="white-space: pre;"> </span>noObjectPathAssociatedWithObject : "The object is not associated with an object identity or the object identity is invalid.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>propertyHasNotBeenInitialized : "The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>collectionHasNotBeenInitialized : "The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requestEmptyQueryName : "The property or query name is empty.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requestHasBeenExecuted : "Request has been executed.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requestAbortedOrTimedOut : "The request was aborted or timed out.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requestUnexpectedResponseWithStatus : "Unexpected response from server. The status code of response is '{0}'. The status text of response is '{1}'.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requestUnexpectedResponse : "Unexpected response from server.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>invalidUsageOfExceptionHandlingScope : "Incorrect usage of exception handling scope.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>unknownError : "Unknown Error",
<span class="Apple-tab-span" style="white-space: pre;"> </span>unknownResponseData : "Unexpected response data from server.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>notSupportedQueryExpressionWithExpressionDetail : "The query expression '{0}' is not supported.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>collectionModified : "The collection was modified. Enumeration operation may not execute.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>cui_AddPerson : "Add Person or Group",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarPrevMonth : "Previous Month",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarNextMonth : "Next Month",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarPrevWeek : "Previous Week",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarNextWeek : "Next Week",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarPrevDay : "Previous Day",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarNextDay : "Next Day",
<span class="Apple-tab-span" style="white-space: pre;"> </span>oneMore : "1 more item",
<span class="Apple-tab-span" style="white-space: pre;"> </span>twoMore : "{0} more items",
<span class="Apple-tab-span" style="white-space: pre;"> </span>collapse : "collapse",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarItemNew : "Add",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarMenuLoading : "Loading items...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarRecurrenceException : "Exception to Recurring Event",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarRecurrence : "Recurring Event",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarNotifyLoading : "Loading calendar...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarNotifyUpdating : "Updating...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarErrorHeader : "Error",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarClientDateOutOfSupportedRangeError : "Specified calendar is out of supported date range.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarDisabledWhileEditing : "This page may have been modified. You may need to reload this page to render the calendar view.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarDeleteConfirm : "Are you sure you want to delete this item?",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarDateTimeSeparator : " - ",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarViewEvent : "View Properties",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarOpenItem : "Open",
<span class="Apple-tab-span" style="white-space: pre;"> </span>calendarResolveError : "No exact match was found for {0}.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>invalidMerge : "The cells you are trying to merge do not have the same height or width. Change the size of the adjacent cells to match the selected cell before merging.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitPt : "pt",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitPx : "px",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitEm : "em",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitCm : "cm",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitIn : "in",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fontSizeUnitMm : "mm",
<span class="Apple-tab-span" style="white-space: pre;"> </span>fonts : "Fonts",
<span class="Apple-tab-span" style="white-space: pre;"> </span>themeFonts : "Theme Fonts",
<span class="Apple-tab-span" style="white-space: pre;"> </span>errorClipboard : "Your browser is not configured to allow access to your computer's clipboard. Use Control+X for Cut, Control+C for Copy, and Control+V for Paste.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>clipboardNoAccess : "Your browser is not configured to allow access to your computer's clipboard. ",
<span class="Apple-tab-span" style="white-space: pre;"> </span>colorPickerStandardHeaderText : "Standard Colors",
<span class="Apple-tab-span" style="white-space: pre;"> </span>colorPickerThemeHeaderText : "Theme Colors",
<span class="Apple-tab-span" style="white-space: pre;"> </span>colorPickerMoreColorsText : "More Colors...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>customBackgroundColorTitle : "Background Color",
<span class="Apple-tab-span" style="white-space: pre;"> </span>customColorTitle : "Color",
<span class="Apple-tab-span" style="white-space: pre;"> </span>editHtmlSourceTitle : "HTML Source",
<span class="Apple-tab-span" style="white-space: pre;"> </span>menuArrangeFloatTitle : "Float",
<span class="Apple-tab-span" style="white-space: pre;"> </span>menuArrangeInlineTitle : "Inline",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuItemWithNumber : "{0} ({1})",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuCENTER : "Centered text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDIR : "Directory list",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuFONT : "Font",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuPLAINTEXT : "Plain text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuS : "Strikethrough",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSTRIKE : "Strikethrough",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuU : "Underline",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuXMP : "Plain text block",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuRT : "Ruby text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuRUBY : "Ruby",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuA : "Anchor",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuABBR : "Abbreviation",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuACRONYM : "Acronym",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuADDRESS : "Address",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuB : "Bold",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuBDO : "Bi-directional text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuBIG : "Big text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuBLOCKQUOTE : "Quotation",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuCAPTION : "Caption",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuCITE : "Citation",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuCODE : "Code",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDD : "Definition description",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDEL : "Deleted text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDFN : "Definition",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDIV : "Text division",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDL : "Definition list",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuDT : "Definition term",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuEM : "Emphasized text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuFIELDSET : "Fieldset",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH1 : "Heading 1",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH2 : "Heading 2",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH3 : "Heading 3",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH4 : "Heading 4",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH5 : "Heading 5",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuH6 : "Heading 6",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuHR : "Horizontal rule",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuI : "Italic",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuIMG : "Image",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuINS : "Inserted Text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuLABEL : "Label",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuLEGEND : "Fieldset legend",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuLI : "List Item",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuMARQUEE : "Marquee",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuMENU : "Menu list",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuNOBR : "No line breaks",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuOL : "Ordered list",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuP : "Paragraph",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuPRE : "Pre-formatted text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuQ : "Short quotation",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSAMP : "Sample",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSMALL : "Small text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSPAN : "Span",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSTRONG : "Strong text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSUB : "Subscript",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuSUP : "Superscript",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTABLE : "Table",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTBODY : "Table body",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTD : "Table cell",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTFOOT : "Table foot",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTH : "Table header cell",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTHEAD : "Table head",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTR : "Table row",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuTT : "Teletype text",
<span class="Apple-tab-span" style="white-space: pre;"> </span>selectMenuUL : "Unordered list",
<span class="Apple-tab-span" style="white-space: pre;"> </span>onPasteTooltip : "Paste Options",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pasteTextLabel : "Keep Text Only",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pasteStripLabel : "Remove Inline Styles",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pasteHtmlLabel : "Keep Inline Styles",
<span class="Apple-tab-span" style="white-space: pre;"> </span>onCellTooltip : "Cell Menu",
<span class="Apple-tab-span" style="white-space: pre;"> </span>deleteRowLabel : "Delete Row",
<span class="Apple-tab-span" style="white-space: pre;"> </span>deleteColumnLabel : "Delete Column",
<span class="Apple-tab-span" style="white-space: pre;"> </span>splitCellLabel : "Split Cell",
<span class="Apple-tab-span" style="white-space: pre;"> </span>insertRowAboveLabel : "Insert Above",
<span class="Apple-tab-span" style="white-space: pre;"> </span>insertRowBelowLabel : "Insert Below",
<span class="Apple-tab-span" style="white-space: pre;"> </span>insertColumnLeftLabel : "Insert Left",
<span class="Apple-tab-span" style="white-space: pre;"> </span>insertColumnRightLabel : "Insert Right",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pasteWaitScreenTitle : "Paste",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pasteWaitScreenText : "Pasting...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>xhtmlWaitScreenTitle : "XHTML",
<span class="Apple-tab-span" style="white-space: pre;"> </span>xhtmlWaitScreenText : "Converting to XHTML...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>xhtmlDone : "XHTML conversion completed",
<span class="Apple-tab-span" style="white-space: pre;"> </span>htmlSourceChangedTitle : "Warning",
<span class="Apple-tab-span" style="white-space: pre;"> </span>htmlSourceChangedText : "The HTML source you entered might have been modified.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUndo_AccessKey : "Z",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUndo_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUndo_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUndo_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRedo_AccessKey : "Y",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRedo_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRedo_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRedo_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutSelectAll_AccessKey : "A",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutSelectAll_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutSelectAll_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutSelectAll_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutBold_AccessKey : "B",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutBold_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutBold_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutBold_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutItalic_AccessKey : "I",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutItalic_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutItalic_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutItalic_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUnderline_AccessKey : "U",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUnderline_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUnderline_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutUnderline_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutClearFormatting_AccessKey : " ",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutClearFormatting_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutClearFormatting_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutClearFormatting_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutIndent_AccessKey : "M",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutIndent_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutIndent_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutIndent_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutOutdent_AccessKey : "M",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutOutdent_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutOutdent_Shift : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutOutdent_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutLeftAlign_AccessKey : "L",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutLeftAlign_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutLeftAlign_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutLeftAlign_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutCenterAlign_AccessKey : "E",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutCenterAlign_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutCenterAlign_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutCenterAlign_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRightAlign_AccessKey : "R",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRightAlign_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRightAlign_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutRightAlign_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutMakeHyperlink_AccessKey : "K",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutMakeHyperlink_Ctrl : "t",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutMakeHyperlink_Shift : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>keyboardShortcutMakeHyperlink_Alt : "f",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tablePreviewChar : "_",
<span class="Apple-tab-span" style="white-space: pre;"> </span>textStyleExampleText : "AaBbCcDdEeFfGgHhIiJjKkLlMm",
<span class="Apple-tab-span" style="white-space: pre;"> </span>reverting : "Reverting...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>sending : "Sending...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>emailDefaultBody : "Sample",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saving : "Saving...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saved : "Saved",
<span class="Apple-tab-span" style="white-space: pre;"> </span>processingRequest : "Processing request...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>deleting : "Deleting...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageIsSiteHomePage : "This page is now the site homepage.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saveChangeDialogTitle : "Save Changes",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saveChangeDialogDesc : "Do you want to save the changes you made to this page?",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saveConflictStatusBarTitle : "Save Conflict:",
<span class="Apple-tab-span" style="white-space: pre;"> </span>saveFailed : "Cannot save the page.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>buttonYes : "Yes",
<span class="Apple-tab-span" style="white-space: pre;"> </span>buttonNo : "No",
<span class="Apple-tab-span" style="white-space: pre;"> </span>buttonCancel : "Cancel",
<span class="Apple-tab-span" style="white-space: pre;"> </span>layoutsNotSupported : "This feature does not support the Layouts Editor.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dropdownImageAltText : "Dropdown",
<span class="Apple-tab-span" style="white-space: pre;"> </span>checkAltText : "Check",
<span class="Apple-tab-span" style="white-space: pre;"> </span>uncheckAltText : "Uncheck",
<span class="Apple-tab-span" style="white-space: pre;"> </span>editListItems : "Edit List Items",
<span class="Apple-tab-span" style="white-space: pre;"> </span>moreItems : "Not all items are shown...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dropdownLoading : "Loading...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>getDataError : "This service isn't available right now.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>getDataErrorRetry : "Click here to try again.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>defaultViewDescription : "Default View",
<span class="Apple-tab-span" style="white-space: pre;"> </span>personalViewDescription : "Personal View",
<span class="Apple-tab-span" style="white-space: pre;"> </span>publicViewDescription : "Public View",
<span class="Apple-tab-span" style="white-space: pre;"> </span>moderationViewDescription : "Moderation View",
<span class="Apple-tab-span" style="white-space: pre;"> </span>close : "Close",
<span class="Apple-tab-span" style="white-space: pre;"> </span>restore : "Restore",
<span class="Apple-tab-span" style="white-space: pre;"> </span>maximize : "Maximize",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dialogLoading : "Loading...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dialogLoadingText : "Please wait while the content loads.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>hiddenButtonValueBeforeDialog : "Wrap focus to the end of the dialog",
<span class="Apple-tab-span" style="white-space: pre;"> </span>hiddenButtonValueAfterDialog : "Wrap focus to the beginning of the dialog",
<span class="Apple-tab-span" style="white-space: pre;"> </span>defaultDialogTitle : "Dialog",
<span class="Apple-tab-span" style="white-space: pre;"> </span>defaultDialogWidth : "768",
<span class="Apple-tab-span" style="white-space: pre;"> </span>defaultDialogHeight : "576",
<span class="Apple-tab-span" style="white-space: pre;"> </span>modelessDialogsNotImplemented : "Modeless dialogs are not implemented.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dialogCancelAK : "C",
<span class="Apple-tab-span" style="white-space: pre;"> </span>confirmWelcomePage : "If you make this page the home page for this site, users will no longer be able to see the old site home page. Do you want to set this page as this site's home page?",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_UnknownError : "Unknown Error.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_RelatedFieldsFetchFailed : "Failed to retrieve related lists for this list.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_DocLibHasNoRelatedLists : "The {0} document library does not have any related lists.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_ListHasNoRelatedLists : "The {0} list does not have any related lists.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_RelatedFetchFieldsTookTooLong : "A timeout occurred while retrieving related lists for this list.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_ListFormsFetchFailed : "Failed to retrieve forms for list.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_NoNewEditDisplayListForms : "This list does not contain any forms.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_DefaultDisplayForm : "Default Display Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_DefaultNewForm : "Default New Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_DefaultEditForm : "Default Edit Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_CTForms : "Content Type Forms",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_CTDisplayForm : "({0}) Display Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_CTNewForm : "({0}) New Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_CTEditForm : "({0}) Edit Form",
<span class="Apple-tab-span" style="white-space: pre;"> </span>relationships_ToolTipTitle : "Insert Related Items Web Part",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dlgTitleDel : "Delete Items",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dlgTitleCheckin : "Check In Files",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dlgTitleCheckout : "Check Out Files",
<span class="Apple-tab-span" style="white-space: pre;"> </span>dlgTitleError : "The server has encountered the following error(s):",
<span class="Apple-tab-span" style="white-space: pre;"> </span>errorDialogTitleText : "Error",
<span class="Apple-tab-span" style="white-space: pre;"> </span>genericLoading : "Loading...",
<span class="Apple-tab-span" style="white-space: pre;"> </span>webPartNotDisplay : "This web part cannot be displayed. Save and stop editing the page to see the web part.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>viewGroupDefault : "Default",
<span class="Apple-tab-span" style="white-space: pre;"> </span>viewGroupPersonal : "Personal",
<span class="Apple-tab-span" style="white-space: pre;"> </span>viewGroupPublic : "Public",
<span class="Apple-tab-span" style="white-space: pre;"> </span>viewGroupModerated : "Moderated",
<span class="Apple-tab-span" style="white-space: pre;"> </span>viewGroupOther : "Other",
<span class="Apple-tab-span" style="white-space: pre;"> </span>modifyViewLabel : "Modify View",
<span class="Apple-tab-span" style="white-space: pre;"> </span>modifyInDesignerLabel : "Modify in SharePoint Designer (Advanced)",
<span class="Apple-tab-span" style="white-space: pre;"> </span>workflowSettingsLabel : "Workflow Settings",
<span class="Apple-tab-span" style="white-space: pre;"> </span>associateWorkflowLabel : "Add a Workflow",
<span class="Apple-tab-span" style="white-space: pre;"> </span>createWorkflowInDesignerLabel : "Create a Workflow in SharePoint Designer",
<span class="Apple-tab-span" style="white-space: pre;"> </span>createReUsableWorkflowInDesignerLabel : "Create a Reusable Workflow in SharePoint Designer",
<span class="Apple-tab-span" style="white-space: pre;"> </span>sendToOtherLocation : "Other Location",
<span class="Apple-tab-span" style="white-space: pre;"> </span>okButtonCaption : "OK",
<span class="Apple-tab-span" style="white-space: pre;"> </span>detailsView : "Details",
<span class="Apple-tab-span" style="white-space: pre;"> </span>thumbnailsView : "Thumbnails",
<span class="Apple-tab-span" style="white-space: pre;"> </span>filmstripView : "Filmstrip",
<span class="Apple-tab-span" style="white-space: pre;"> </span>modifyThisView : "Modify this view",
<span class="Apple-tab-span" style="white-space: pre;"> </span>createView : "Create view",
<span class="Apple-tab-span" style="white-space: pre;"> </span>editColEditable : "Editable",
<span class="Apple-tab-span" style="white-space: pre;"> </span>editColReadOnly : "Read Only",
<span class="Apple-tab-span" style="white-space: pre;"> </span>deleteText : "Delete",
<span class="Apple-tab-span" style="white-space: pre;"> </span>deleteFailed : "This item could not be deleted",
<span class="Apple-tab-span" style="white-space: pre;"> </span>requiredField : "This field requires a value.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>serverCommError : "Unable to communicate with the server.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>savingToServer : "Changes are currently being saved back to the server. If you leave now, some of those changes may be lost.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>changesHaveNotBeenSaved : "Changes have been made that have not yet been saved back to the server. If you leave now, all of those changes will be lost.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>docAlreadyExists : "The specified name is already in use. A summary task cannot have the same name as another summary task in the current list.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>ganttListName : "Project Tasks",
<span class="Apple-tab-span" style="white-space: pre;"> </span>createWaitScreenCancel : "Cancel",
<span class="Apple-tab-span" style="white-space: pre;"> </span>checkInComments : "Comments:",
<span class="Apple-tab-span" style="white-space: pre;"> </span>okButtonText : "OK",
<span class="Apple-tab-span" style="white-space: pre;"> </span>continueButtonText : "Continue",
<span class="Apple-tab-span" style="white-space: pre;"> </span>cancelButtonText : "Cancel",
<span class="Apple-tab-span" style="white-space: pre;"> </span>okCancelButtonWidth : "6em",
<span class="Apple-tab-span" style="white-space: pre;"> </span>alignRight : "right",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateCancelApprovalLabel : "Cancel Approval",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateDiscardCheckoutLabel : "Discard Check Out",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateDontSaveLabel : "Exit Without Saving",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateEditLabel : "Edit",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSaveLabel : "Save",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateCheckinLabel : "Check In",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateCheckoutLabel : "Check Out",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateOverrideCheckoutLabel : "Override Check Out",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStatePublishLabel : "Publish",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSaveAndStopEditingLabel : "Save and Stop Editing",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSubmitForApprovalLabel : "Submit for Approval",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateUnpublishLabel : "Unpublish",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateApproveLabel : "Approve",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateRejectLabel : "Reject",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSaveBeforeNavigateUnknownError : "The page took too long to save. You can click "Cancel", and then try to save the page again. If you click "OK", you might lose unsaved data.",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSaveBeforeNavigateNotCheckedOutWarning : "To save your changes before continuing, click "OK". To continue without saving changes, click "Cancel".",
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageStateSaveBeforeNavigateLastChanceWarning : "You have made changes to your page that have not yet been saved. Are you sure you want to discard those changes?",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tenantAdmin_SiteCollectionNewDialogTitle : "Create Site Collection",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tenantAdmin_SiteCollectionDeleteDialogTitle : "Delete Site Collections",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tenantAdmin_SiteCollectionPropertiesDialogTitle : "Site Collection Properties",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tenantAdmin_SiteCollectionOwnersDialogTitle : "Site Collection Owners",
<span class="Apple-tab-span" style="white-space: pre;"> </span>tenantAdmin_SiteCollectionDiskQuotaDialogTitle : "Site Collection Disk Quota",
<span class="Apple-tab-span" style="white-space: pre;"> </span>rteDialog_Height : "175",
<span class="Apple-tab-span" style="white-space: pre;"> </span>rteDialog_Width : "400",
<span class="Apple-tab-span" style="white-space: pre;"> </span>renamePageDialog_Title : "Rename Page",
<span class="Apple-tab-span" style="white-space: pre;"> </span>webPartPageRecycleConfirmation : "Are you sure you want to send this page to the site Recycle Bin?",
<span class="Apple-tab-span" style="white-space: pre;"> </span>webPartPageDeleteConfirmation : "Are you sure you want to permanently delete this page?"
}</pre>
<br />
Some mighty fine messages ready for reuse... I'll continue to post some more obscure things I'm finding as I dig deeper into the depths of sp.js. </div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com2tag:blogger.com,1999:blog-4810971256241483630.post-70334734279321067552012-04-02T15:11:00.002-04:002012-04-02T15:24:55.206-04:00Modifying the default language in InfoPath<div dir="ltr" style="text-align: left;" trbidi="on">
This will be a quick exercise on how to change the language you can write within InfoPath 2007...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghL43Fk2NRFM3Bg9GTl9hSCJB9NEDHCQWIK9UuFjGgcnqmHRbC6lcZETa9_UYNmfeGU2cm9MX5wkAUull-unOpp69hP93817LVJeX-OI9uVNLRfzgR867QN9Xrxo1wO7aM2q0T55CQXWde/s1600/InfoPath.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="Click on Form Options" border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghL43Fk2NRFM3Bg9GTl9hSCJB9NEDHCQWIK9UuFjGgcnqmHRbC6lcZETa9_UYNmfeGU2cm9MX5wkAUull-unOpp69hP93817LVJeX-OI9uVNLRfzgR867QN9Xrxo1wO7aM2q0T55CQXWde/s320/InfoPath.png" title="Click on Form Options" width="320" /></a></div>
Crack open your favorite form builder and then click on Tools. From that menu, click on Programming on the left... You should already know where I'm going with this. Let's change that default (C#) to something nonsensical, unstructured and putrid; yet everyone seems to be jumping on the bandwagon: <a href="https://developer.mozilla.org/en/JavaScript">JavaScript</a> or in this case JScript. Whatev...<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">(¸¸.♥➷♥•*¨)¸.•´¸.•*¨) ¸.•*¨)</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">(¸.•´(¸. ¸.•´¸.•*¨) ¸.♥➷•*¨)</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">─▀██▀─▄███▄─▀██─██▀██▀▀▀█─</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">──██─███─███─██─██─██▄█──conquers</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">──██─▀██▄██▀─▀█▄█▀─██▀█──all ♥➷♥</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">─▄██▄▄█▀▀▀─────▀──▄██▄▄▄█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">¸.•´¸.•*¨) ¸♥.•*¨) (¸.•´¸♥➷♥¸.•´♥¸.•´♥¸.•*¨)♥.•*¨)¸.•*♥¸</span>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv28Ae4_3HkuBUlKPQolvWE2sLFXbZ6u4be7NM2bPHEcsYqwqD2iUg0Btxn-3sV3k7P2vA9Z6nqsPHJk3ry-lMKGKd18v5tdOjG-xGoznct8gZXVpgUOuju8dSmXxGw_Zn44sjjufbqfsr/s1600/InfoPath2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="Form Options" border="0" height="293" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv28Ae4_3HkuBUlKPQolvWE2sLFXbZ6u4be7NM2bPHEcsYqwqD2iUg0Btxn-3sV3k7P2vA9Z6nqsPHJk3ry-lMKGKd18v5tdOjG-xGoznct8gZXVpgUOuju8dSmXxGw_Zn44sjjufbqfsr/s320/InfoPath2.png" title="Form Options" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">(¸¸.♥➷♥•*¨)¸.•´¸.•*¨) ¸.•*¨)</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">(¸.•´(¸. ¸.•´¸.•*¨) ¸.♥➷•*¨)</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">─▀██▀─▄███▄─▀██─██▀██▀▀▀█─</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">──██─███─███─██─██─██▄█──conquers</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">──██─▀██▄██▀─▀█▄█▀─██▀█──all ♥➷♥</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">─▄██▄▄█▀▀▀─────▀──▄██▄▄▄█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;">¸.•´¸.•*¨) ¸♥.•*¨) (¸.•´¸♥➷♥¸.•´♥¸.•´♥¸.•*¨)♥.•*¨)¸.•*♥¸</span>
<br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px;"><br /></span><br />
<br />
<br />
I've decided from now on any InfoPath post will need something extra for me, so I can start to<br />
<div>
<br />
<div>
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">░░░░░░░░░░░░▄▄</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">░░░░░░░░░░░█░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">░░░░░░░░░░░█░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">░░░░░░░░░░█░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">░░░░░░░░░█░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">███████▄▄█░░░░░██████▄</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█░░░░░░░░░░░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█░░░░░░░░░░░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█░░░░░░░░░░░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█░░░░░░░░░░░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█░░░░░░░░░░░░░░█</span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">▓▓▓▓▓▓█████░░░░░░░░░█ </span><br />
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;">██████▀░░░░▀▀██████▀</span>
</div>
<div>
<span style="background-color: white; font-family: Verdana, Geneva, sans-serif; font-size: 15px; line-height: 16px; text-align: left;"><br /></span></div>
<span style="font-family: inherit;">it...</span><br />
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Want to see what damage I can do? Stay tuned...</span></div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-60074060512584493432012-03-26T15:19:00.000-04:002012-03-26T15:19:30.799-04:00Get the ID of any SharePoint Wiki page<div dir="ltr" style="text-align: left;" trbidi="on">
Hello _spPageContextInfo!!!<br />
I found this little gem by viewing the source of my site <a href="http://spdwiki.com/">spdwiki.com</a>. Simply running a console.dir() on this object reveals these properties:<br />
<br />
<br />
<ol class="properties properties-tree monospace" style="background-color: white; box-sizing: border-box; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 2px; padding-left: 16px; padding-right: 6px; padding-top: 0px; text-align: -webkit-auto; white-space: pre-wrap;" tabindex="0">
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">alertsEnabled</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-boolean" style="box-sizing: border-box;">true</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">allowSilverlightPrompt</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"True"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">currentLanguage</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1033</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">pageItemId</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">pageListId</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"{15d98081-a722-48ad-a30c-c25d4c31a228}"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">siteServerRelativeUrl</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"/"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">userId</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webLanguage</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1033</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webServerRelativeUrl</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"/"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webUIVersion</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">4</span></li>
</ol>
<br />
<br />
I've noticed running this same inquiry on a different site, say <a href="http://www.sharepointfabian.com/">http://www.sharepointfabian.com</a>, the properties are different:<br />
<br />
<br />
<ol class="properties properties-tree monospace" style="background-color: white; box-sizing: border-box; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 2px; padding-left: 16px; padding-right: 6px; padding-top: 0px; text-align: -webkit-auto; white-space: pre-wrap;" tabindex="0">
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">alertsEnabled</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-boolean" style="box-sizing: border-box;">true</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">allowSilverlightPrompt</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"True"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">currentLanguage</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1033</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">pageListId</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"{a4668dd2-4dac-4cce-baf0-ddb1ea4f2d5e}"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">siteServerRelativeUrl</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"/"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webLanguage</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">1033</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webServerRelativeUrl</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-string" style="box-sizing: border-box; color: #c41a16; white-space: pre;">"/blog"</span></li>
<li style="-webkit-user-select: text; box-sizing: border-box; cursor: default; margin-left: 12px; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap;" title=""><span class="name" style="box-sizing: border-box; color: #881391;">webUIVersion</span><span class="separator" style="box-sizing: border-box;">: </span><span class="value console-formatted-number" style="box-sizing: border-box; color: #1c00cf;">4</span></li>
</ol>
<br />
<br />
It's safe to say, this is because the latter is a blog and not a wiki. <br />
<br />
What to make of all of this? I'm able to display pertinent data accordingly and no longer required to rely on the text of the page name.<br />
<br />
var pageID = _spPageContextInfo.pageItemId;<br />
<br />
It's a much cleaner solution that just feels good.<br />
<br />
I've been working on a commenting system for a SharePoint 2010 system. Knowing some of these internal variables that are floating around is invaluable. Hope you find this useful as well.<br />
<br />
Yes Josh, I'm going to finish this finally. ;-)</div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-88025953238795564742012-03-21T22:47:00.000-04:002012-03-22T10:50:53.268-04:00Add Notepad++ to the context menu<p>This little regedit keeps coming in handy. Thought I’d add it here so it’s easy for me to find and the other 2 of you that read this blog.</p><pre class="brush: c-sharp; toolbar: false">Windows Registry Editor Version 5.00<br /><br />[HKEY_CLASSES_ROOT\*\shell\Open with Notepad++\command]<br />@="\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" \"%1\""</pre><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWFoYhODiOlxVbnx6Q2Vm_MR0zVg5YqwrsUvEgDr-_XFP6cwj5FkP11X5u7yOxoN_YPGA4HKdf1N7D1ZBBZTWSVZIIAm2qSKCWWZ9XQ1pcvat-ZYxTMBlNajSSy-i6-vMmef-mqAopZShf/s1600-h/ContextMenu%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="ContextMenu" border="0" alt="ContextMenu" align="left" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXUHktmv8VW1B3pAx9txW6vAdXxfflpEf3rJRCWO4N8yXBMlmTTxh6MfWFJrxxveCAI2rTpvqzDa-9JF_qVMrCVYTAAYQrlKuc2dEXVejbz3qnlBBL7cHmPkdpHy4uXcJXvvl3wZdY6NsJ/?imgmax=800" width="326" height="185"></a>Save that into a file with the extension .reg and double click it to add to the registry. You’ll now see Open with Notepad++ in the context menu.</p><br /><p>Pretty awesome, eh? You can add whatever else you like to your context menu as well. As always though be cautious when modifying the registry.</p><br /><p>I’ve seen people wreck, destroy, obliterate their machine fiddling with things they shouldn’t have. With that said, have fun doing it! </p><br /><br /><br /><p>This post was inspired by: <a href="http://www.sevenforums.com/software/29942-notepad-context-menu.html">http://www.sevenforums.com/software/29942-notepad-context-menu.html</a></p>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com5tag:blogger.com,1999:blog-4810971256241483630.post-6734186644789794292012-03-02T15:44:00.000-05:002012-03-26T15:04:56.043-04:00roboCAML v0.4 has been released!<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: small;"><a href="http://robocaml.codeplex.com/" target="_blank"><img align="left" alt="RoboCAML" border="0" height="103" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglT9x8OvWjtrPXvKiXywPJ01bSg2p34hxl4Z0etQ2HV7zM-UjKs0O0KpRlj3dZJjABRIEaDYCphMf0E1QMSeyGi8EUvxvEhjVlPo0vWa1VMqwGMHAZJ8WmH3mcic_ddFLA2FeV0XnWNAMJ/?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; float: left; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="RoboCAML" width="137" /></a>You may have seen me tweet about </span><a href="http://robocaml.codeplex.com/" target="_blank" title="roboCAML"><span style="font-size: small;">roboCAML</span></a><span style="font-size: small;"> the last few days. If you were scratching your head about what it actually is, don’t feel bad. No one knew… It’s a jQuery </span><a href="http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth" target="_blank"><span style="font-size: small;">module</span></a><span style="font-size: small;">, *<strong>not*</strong> </span><a href="http://stefangabos.ro/jquery/jquery-plugin-boilerplate-revisited/" target="_blank"><span style="font-size: small;">a plugin</span></a><span style="font-size: small;">, I’ve built specifically to handle the tedious task of manually building </span><a href="http://mattbramer.blogspot.com/search/label/CAML" target="_blank"><span style="font-size: small;">CAML</span></a> or worse hard coding CAML<span style="font-size: small;"> within your scripts. An added benefit, is the ability to create dynamic CAML queries on the fly.<br /><br />Currently </span><a href="http://robocaml.codeplex.com/" target="_blank"><span style="font-size: small;">roboCAML</span></a><span style="font-size: small;"> has a depends on jQuery, but very well may become a pure JavaScript module without any external dependencies. It's hard to beat the $.ajax function within jQuery, but I'm willing to change based on feedback. It’s all about the community, you know?</span></div>
<h4 dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large; font-weight: bold;">What does it do?</span></h4>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: small;">roboCAML takes away the pain of scripts that look like this:</span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<pre><pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// #CAMLToggle doesn't exist, but this is here in case we want to give the user the ability to AND</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// or OR the PartNum</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> <span style="color: blue;">var</span> camlToggle = $("<span style="color: darkred;">#CAMLToggle</span>").val() ? $("<span style="color: darkred;">#CAMLToggle</span>").val() : "<span style="color: darkred;">Or</span>",</span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> ddlSelected = <span style="color: blue;">false</span>,</span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> PartCat = [],</span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> PartNum = [],</span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> thisFieldRef = "<span style="color: darkred;"></span>",</span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery = "<span style="color: darkred;"></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> $( "<span style="color: darkred;">select.PartCat</span>" ).each(<span style="color: blue;">function</span>() {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// Each select on the page has the PartCat class</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// the title attribute is also the name of the field for the CAML</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> ctlTitle = $(<span style="color: blue;">this</span>).attr("<span style="color: darkred;">title</span>");</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> PartCat[ctlTitle] = ctlTitle;</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> ( ctlTitle ) != 0 ) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> ddlSelected = <span style="color: blue;">true</span>;</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span><span style="font-size: x-small;">}</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> });</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="color: #38761d;"><span style="font-size: x-small;">//First example of CAML engine</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> i = 0;</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">for</span> (index <span style="color: blue;">in</span> PartCat) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">//console.log("Select title: " + i);</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">//console.log("Select Val: " + PartCat[i]);</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> (PartCat[index] > 0) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> thisFieldRef = "<span style="color: darkred;"><Eq><FieldRef Name='</span>" + index + "<span style="color: darkred;">' LookupId='True' /><Value Type='Number'></span>" + PartCat[index] + "<span style="color: darkred;"></Value></Eq></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> (i <= 1) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery += thisFieldRef;</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> (i == 1) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery = "<span style="color: darkred;"><And></span>" + camlQuery + "<span style="color: darkred;"></And></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span><span style="font-size: x-small;">}</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> (i > 1) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery = "<span style="color: darkred;"><And></span>" + camlQuery + thisFieldRef + "<span style="color: darkred;"></And></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> i++;</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="color: #38761d;"><span style="font-size: x-small;">//Show example of other CAML Engine</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> $("<span style="color: darkred;">input.PartNum:checked</span>").each(<span style="color: blue;">function</span>(index) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// If this isn't the first PartNum, we'll "wrap" the array with the camlToggle</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span>(index > 0) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> PartNum.unshift("<span style="color: darkred;"><</span>" + camlToggle + "<span style="color: darkred;">></span>");</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> PartNum.push("<span style="color: darkred;"><Eq><FieldRef Name='PartNum' LookupId='True' /><Value Type='Number'></span>" + $(<span style="color: blue;">this</span>).attr("<span style="color: darkred;">alt</span>") + "<span style="color: darkred;"></Value></Eq></span>");</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// If this isn't the first PartNum, we'll "wrap" the array with the camlToggle</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"> <span style="color: blue;">if</span>(index > 0)</span> {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> PartNum.push("<span style="color: darkred;"></</span>" + camlToggle + "<span style="color: darkred;">></span>");</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span><span style="font-size: x-small;">}</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> });</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// .join() defaults to commas, .join("") does the same thing. We'll join with a space, then replace</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// the spaces that fall between tags</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery += PartNum.join("<span style="color: darkred;"> </span>").replace(/> </gi,"<span style="color: darkred;">><</span>");</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: blue;">if</span> ( $("<span style="color: darkred;">input.PartNum:checked</span>").<span style="color: blue;">length</span> > 0 && ddlSelected ) {</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> <span style="color: green;">// If we have DDLs and PartNums, we'll <And> the two groups together, otherwise we won't</span></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery = "<span style="color: darkred;"><And></span>" + camlQuery + "<span style="color: darkred;"></And></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> }</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"></span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> camlQuery = "<span style="color: darkred;"><Query><Where></span>" + camlQuery + "<span style="color: darkred;"></Where><OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy></Query></span>";</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"> GetListItems(camlQuery);</span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"> </span><span style="font-size: x-small;">}</span></pre>
</pre>
</div>
<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-size: small;">Within this script are two different ways to dynamically build CAML. Each have their merits, but why do I have to think about setting up my CAML correctly and debugging it if I am having issues? After being tasked to build a few of the complex scripts, sometimes several in a week, I had enough... Time to roll up the sleeves and code a solution. This is why I’ve built roboCAML, so now lets see what it does.</span><br />
<span style="font-size: small;"><br /></span></div>
<h4 dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large; font-weight: bold;">roboCAML In Action</span></h4>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: small;">roboCAML will assist in generating a string of useful CAML for use when making your </span><a href="http://msdn.microsoft.com/en-us/library/ee556847.aspx" target="_blank"><span style="font-size: small;">Web Service</span></a><span style="font-size: small;"> or </span><a href="http://msdn.microsoft.com/en-us/library/ee857094.aspx" target="_blank"><span style="font-size: small;">Client Object Model</span></a><span style="font-size: small;"> calls. There are currently 5 methods available in roboCAML.</span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ol>
<li><a href="http://robocaml.codeplex.com/wikipage?title=roboCAML.BatchCMD%28%29%3b"><span style="font-size: small;">roboCAML.BatchCMD</span></a> </li>
<li><a href="http://robocaml.codeplex.com/wikipage?title=OrderBy"><span style="font-size: small;">roboCAML.OrderBy</span></a> </li>
<li><a href="http://robocaml.codeplex.com/wikipage?title=roboCAML.Query%28%29%3b"><span style="font-size: small;">roboCAML.Query</span></a> </li>
<li><a href="http://robocaml.codeplex.com/wikipage?title=QueryOptions"><span style="font-size: small;">roboCAML.QueryOptions</span></a> </li>
<li><span style="font-size: small;"><a href="http://robocaml.codeplex.com/wikipage?title=ViewFields">roboCAML.ViewFields</a></span></li>
</ol>
</div>
<h4>
<span style="font-size: large; font-weight: bold;">roboCAML.BatchCMD</span></h4>
<pre><span style="font-family: arial; font-size: x-small;"><span style="font-family: Calibri; font-size: small;">So, now let’s look at roboCAML.BatchCMD method. This method is a little tricky because there are three distinct actions you can take when using a batch. Each requiring a different set of parameters. In example 2.1, we’ll look at </span><a href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx" target="_blank"><strong><span style="font-family: Calibri; font-size: small;">Deleting</span></strong></a><span style="font-family: Calibri; font-size: small;">:</span></span></pre>
<pre class="brush: c-sharp; toolbar: false"><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Example 2.1:</span></pre>
<pre class="brush: c-sharp; toolbar: false"><span style="font-size: x-small;">roboCAML.BatchCMD({
batchCMD: 'Delete',
IDs: [1,2,3]
});</span></pre>
<br />
<span style="font-size: small;">This call accepts an array of ID’s and the “Delete” command. The output will be:</span><br />
<pre><pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"><span style="color: blue;"><</span><span style="color: maroon;">Batch</span> <span style="color: red;">OnError</span>=<span style="color: blue;">'Continue'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Method</span> <span style="color: red;">ID</span>=<span style="color: blue;">'3'</span> <span style="color: red;">Cmd</span>=<span style="color: blue;">'Delete'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ID'</span><span style="color: blue;">></span>3<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Method</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Method</span> <span style="color: red;">ID</span>=<span style="color: blue;">'2'</span> <span style="color: red;">Cmd</span>=<span style="color: blue;">'Delete'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ID'</span><span style="color: blue;">></span>2<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Method</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Method</span> <span style="color: red;">ID</span>=<span style="color: blue;">'1'</span> <span style="color: red;">Cmd</span>=<span style="color: blue;">'Delete'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ID'</span><span style="color: blue;">></span>1<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Method</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Batch</span><span style="color: blue;">></span></span> </span></pre>
</pre>
<pre><span style="font-family: arial;"><span style="font-family: Calibri; font-size: small;">Now onto the <a href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx">New</a></span><span style="font-family: Calibri; font-size: small;"> operation. This example accepts the command for the batch. What is different here from the Delete operation is, we can now pass in a valuePairs parameter. This parameter accepts an </span><a href="http://www.hunlock.com/blogs/Mastering_Javascript_Arrays" target="_blank"><span style="font-family: Calibri; font-size: small;">array of arrays</span></a><span style="font-family: Calibri; font-size: small;">. You’ll notice each array follows a certain pattern. First the Static Name is provided and then the value.</span></span></pre>
<pre><span style="font-family: arial;"><span style="font-family: Calibri; font-size: x-small;">Example: 2.2:</span></span></pre>
<pre class="brush: javascript; toolbar: false"><span style="font-size: x-small;">roboCAML.BatchCMD({
batchCMD: "New",
valuePairs: [["PersonnelLookup", 1]] //Static Column Name, Value
});</span></pre>
<br />
<span style="font-size: small;">A more complex array would look like this:</span><br />
<pre class="brush: javascript; toolbar: false"><span style="font-size: x-small;">roboCAML.BatchCMD({
batchCMD: "New",
valuePairs: [["PersonnelLookup", 1, "ModuleNotes", "ModuleNotes", "Description", "Googly Glop"], ["ListUID", 3]] //Static Column Name, Value
});</span></pre>
<br />
<span style="font-size: small;">Which in turn produces:</span><br />
<pre><pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;"><span style="color: blue;"><</span><span style="color: maroon;">Batch</span> <span style="color: red;">OnError</span>=<span style="color: blue;">'Continue'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Method</span> <span style="color: red;">ID</span>=<span style="color: blue;">'1'</span> <span style="color: red;">Cmd</span>=<span style="color: blue;">'New'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'PersonnelLookup'</span><span style="color: blue;">></span>1<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ModuleNotes'</span><span style="color: blue;">></span>ModuleNotes<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'Description'</span><span style="color: blue;">></span>Googly Glop<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Method</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Method</span> <span style="color: red;">ID</span>=<span style="color: blue;">'2'</span> <span style="color: red;">Cmd</span>=<span style="color: blue;">'New'</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">Field</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ListUID'</span><span style="color: blue;">></span>3<span style="color: blue;"></</span><span style="color: maroon;">Field</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Method</span><span style="color: blue;">></span><span style="color: blue;"></</span><span style="color: maroon;">Batch</span><span style="color: blue;">></span> </span></pre>
<pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"></span></pre>
</pre>
<span style="font-family: arial; font-size: x-small;"><span style="font-family: Calibri; font-size: small;">The last operation within roboCAML.BatchCMD is </span><a href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx" target="_blank"><span style="font-family: Calibri; font-size: small;">Update</span></a></span><span style="font-family: arial; font-size: x-small;"><span style="font-family: Calibri; font-size: small;">:</span></span><br />
<br />
<pre><span style="font-family: arial; font-size: x-small;"><span style="font-family: Calibri; font-size: x-small;">Example 2.3</span></span></pre>
<pre class="brush: javascript; toolbar: false">roboCAML.BatchCMD({
updates: [
{
//Notice batchCMD isn't present...
//Static Column Name, Value
valuePairs: ["Title", "Numero Tres", "PercentComplete", 1, "Boolean", 0, "ID", 3]
},
{
//Defaults to Update anyway. No need to pass it.
batchCMD: "Update",
valuePairs: ["ID", 4, "Title", "Item4", "Boolean", 0]
},
{
batchCMD: "New",
valuePairs: ["Title", "Something New", "PercentComplete", 1]
},
{
batchCMD: "Delete",
ID: 6
}
]
});</pre>
<br />
The output of the call above will generate:<br />
<pre class="brush: xhtml; toolbar: false"><Batch OnError='Continue'>
<Method ID='1' Cmd='Update'>
<Field Name='Title'>Numero Tres</Field>
<Field Name='PercentComplete'>1</Field>
<Field Name='Boolean'>0</Field>
<Field Name='ID'>3</Field>
</Method>
<Method ID='2' Cmd='Update'>
<Field Name='ID'>4</Field>
<Field Name='Title'>Item4</Field>
<Field Name='Boolean'>0</Field>
</Method>
<Method ID='3' Cmd='New'>
<Field Name='Title'>Something New</Field>
<Field Name='PercentComplete'>1</Field>
</Method>
<Method ID='4' Cmd='Delete'>
<Field Name='ID'>6</Field>
</Method>
</Batch></pre>
<br />
What’s<strong><em> very interesting</em></strong> with using the updates property of roboCAML.BatchCMD is the batch that is generated can be chocked full of all your different operations. Delete, New and Update all within one Web Service call. That’s #bada55.<br />
<br />
<h4>
<div class="MsoNormal">
roboCAML.OrderBy<o:p></o:p></div>
</h4>
<div class="MsoNormal">
<br /></div>
<span style="font-weight: normal;">And if you weren’t impressed by any of the above, maybe this
will persuade you… It’s another snazzy way to build CAML on the fly. Here’s how
to use roboCAML.OrderBy:<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<pre class="brush: javascript; toolbar: false">roboCAML.OrderBy({
MyColumn: false,
ID: true
});</pre>
<span style="font-family: arial;"><span style="font-family: Calibri;"><span style="font-size: x-small;"><strong>Note: </strong><em>The value of each staticName can be a boolean or a string...</em></span></span></span>
<span style="font-family: arial;"><span style="font-family: Calibri; font-size: small;">The output of the call above will look like this:</span></span>
<br />
<pre class="brush: xhtml; toolbar: false"><OrderBy><FieldRef Name='MyColumn' Ascending='False' /><FieldRef Name='ID' Ascending='True' /></OrderBy></pre>
<br />
<h4>
<span style="font-size: large; font-weight: bold;">roboCAML.Query</span><br />
</h4>
<span style="font-weight: normal;"><span style="font-size: small;"></span>Probably the most interesting method roboCAML has to offer. There are a plethora of options within this method. The best way to learn how to use this would be to <a href="http://robocaml.codeplex.com/wikipage?title=roboCAML.Query%28%29%3b" target="_blank">read the docs</a> or use the <a href="http://spdwiki.com/sitepages/robocaml.aspx" target="_blank">live demo</a>. Let’s look over a sample query you can use with roboCAML.</span>
<br />
<pre class="brush: javascript; toolbar: false">roboCAML.Query({
listName: 'Calendar',
closeCaml: "Clientom",
ViewFields: ["ID", "Created", "Title"],
OrderBy: {
ID: true
},
QueryOptions: {
IncludeMandatoryColumns: false
},
config: [
{
filter: "&&",
op: "*",
staticName: "Title",
value: "Daily"
},
{
filter: "&&",
op: "^",
staticName: "Title",
value: "Deleted"
},
{
op: "!=",
staticName: "ID",
value: 3
}
]
});</pre>
<pre class="brush: javascript; toolbar: false"></pre>
<span style="font-weight: normal;">
Since the CAML is not hardcoded, you can now easily generate whatever options needed to retrieve information from <a href="http://mattbramer.blogspot.com/search/label/SharePoint" target="_blank">SharePoint</a>. Just like above in the “CAML Engines”, stuff an array full of info and do something with it... I’m thinking of building a demo soon that will serve as a real world example of why this is useful for front-end development.</span>
<span style="font-size: small; font-weight: normal;">In case you were wondering, this is the output from heavy lifting done from roboCAML:</span>
<span style="font-size: small;"></span><br />
<pre class="brush: xhtml; toolbar: false"><span style="font-size: small;"><View>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='Created' />
<FieldRef Name='ID' />
</ViewFields>
<Query>
<Where>
<And>
<Contains>
<FieldRef Name='Title' />
<Value Type='Text'>Daily</Value>
</Contains>
<And>
<BeginsWith>
<FieldRef Name='Title' />
<Value Type='Text'>Deleted</Value>
</BeginsWith>
<Neq>
<FieldRef Name='ID' />
<Value Type='Counter'>3</Value>
</Neq>
</And>
</And>
</Where>
<OrderBy>
<FieldRef Name='ID' Ascending='True' />
</OrderBy>
</Query>
<IncludeMandatoryColumns>False</IncludeMandatoryColumns>
</View></span></pre>
<span style="font-size: small;">
</span>
<br />
<h4>
<span style="font-size: large; font-weight: bold;">roboCAML.QueryOptions</span>
</h4>
<span style="font-weight: normal;">
This method will assist you in building queries and other various CAML fragments that you may need. I haven’t found a comprehensive list that details all of the options available within this node. The closest I’ve come to full documentation was on the <span style="font-size: small;"><a href="http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx" target="_blank">Lists.GetListItems Method</a></span> page within MSDN. As I find/test/evaluate each new option I find, I’ll piecemeal them into the project.</span>
<span style="font-weight: normal;">
For now, the documentation can be found on the <a href="http://robocaml.codeplex.com/wikipage?title=QueryOptions" target="_blank">roboCAML project page</a>.</span>
<br />
<h4>
<span style="font-size: large; font-weight: bold;">roboCAML.ViewFields</span></h4>
<span style="font-size: small;">As you could guess (if you are familiar with CAML), this does exactly what you would expect. Let’s take a look at roboCAML.ViewFields:</span><br />
<span style="font-size: small;"><br /></span><br />
<pre><pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: x-small;">roboCAML.ViewFields(["<span style="color: darkred;">Title</span>", "<span style="color: darkred;">Description</span>", "<span style="color: darkred;">ProjectName</span>", "<span style="color: darkred;">RelatedID</span>"]);</span></pre>
</pre>
<br />
<span style="font-size: small;">This method accept an array of </span><a href="http://robocaml.codeplex.com/wikipage?title=Glossary" target="_blank">Static Names</a>.<span style="font-size: small;"></span><span style="font-size: small;"> The output will be:</span><br />
<pre><pre style="background-color: white; font-family: consolas,'Courier New',courier,monospace; font-size: 12px; margin: 0em; width: 100%;"><span style="font-size: small;"><span style="font-size: x-small;"><span style="color: blue;"><</span><span style="color: maroon;">ViewFields</span><span style="color: blue;">></span><span style="color: blue;"><</span><span style="color: maroon;">FieldRef</span> <span style="color: red;">Name</span>=<span style="color: blue;">'RelatedID'</span> <span style="color: blue;">/></span><span style="color: blue;"><</span><span style="color: maroon;">FieldRef</span> <span style="color: red;">Name</span>=<span style="color: blue;">'ProjectName'</span> <span style="color: blue;">/></span><span style="color: blue;"><</span><span style="color: maroon;">FieldRef</span> <span style="color: red;">Name</span>=<span style="color: blue;">'Description'</span> <span style="color: blue;">/></span><span style="color: blue;"><</span><span style="color: maroon;">FieldRef</span> <span style="color: red;">Name</span>=<span style="color: blue;">'Title'</span> <span style="color: blue;">/></span><span style="color: blue;"></</span><span style="color: maroon;">ViewFields</span><span style="color: blue;">></span></span> </span></pre>
</pre>
<pre><span style="font-family: arial; font-size: x-small;"><span style="font-family: Calibri; font-size: small;">It’s just that simple… Really!</span></span></pre>
<br />
<span style="font-size: small;">There you have it, </span><a href="http://robocaml.codeplex.com/" target="_blank" title="roboCAML"><span style="font-size: small;">roboCAML</span></a><span style="font-size: small;"> in a nutshell. I’m missing some key parts that you *should* be able to do when creating CAML queries for SharePoint. I plan on adding them very soon! Support for </span><a href="http://msdn.microsoft.com/en-us/library/aa544234.aspx" target="_blank"><span style="font-size: small;"><Membership /></span></a><span style="font-size: small;">, <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.joins.aspx" target="_blank"><Joins></a> (if it’s possible, haven’t tried yet...), and <a href="http://msdn.microsoft.com/en-us/library/ee539975.aspx" target="_blank"><ProjectedFields></a> are on top of my list as well as <a href="http://robocaml.codeplex.com/workitem/756" target="_blank">nested CAML fragments</a> (Thanks <a href="http://twitter.com/jbhoward" target="_blank">Jim Bob</a>!). If you can think of anything you’d like to see added, </span><a href="http://robocaml.codeplex.com/discussions" target="_blank"><span style="font-size: small;">feel free to ask</span></a><span style="font-size: small;">. </span><br />
<br />
<span style="font-size: small;"><img align="left" height="154" src="http://bit.ly/mNBcVN.qrcode" style="display: inline; float: left;" width="152" /></span><br />
<br />
<span style="font-size: small;"></span></div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-89109690863406757922012-02-12T21:13:00.001-05:002012-02-13T10:25:35.467-05:00Subtle differences using ViewFields vs. Include with Client Object Model<p>I’ve been diving more and more into Client OM/JSOM, in order to get my <a href="http://robocaml.codeplex.com" target="_blank">roboCAML</a> codeplex project up to snuff. Of course, I’m going to be hacking away at examples and trying to make sense of it all. The first thing I needed was to visualize the data I’m working with; <em>muy importante para mi</em>. Hacking away in the console, I was able to find where all of the awesome data is hidden. So the stage is set...</p> <p>Using a standard function, I’m successfully retrieving data from SharePoint. So far, so good... Here’s the code I’m using:</p><pre class="brush: javascript; toolbar: false">function queryList() {</pre><pre class="brush: javascript; toolbar: false">//...-->SNIP<--...//<br /><br /> var viewXml = roboCAML.Query({<br /> listName: "Child",<br /> closeCaml: "ClientOM",<br /> //ViewFields: ["MultiSelectLookup", "MyDollars", "DateAndTime"],<br /> config: [<br /> {<br /> filter: "&&",<br /> op: "=",<br /> staticName: "MultiSelectLookup",<br /> value: 4,<br /> lookupId: true<br /> },<br /> {<br /> filter: "And",//I really like “&&”, but added this to show flexibility<br /> op: "=",<br /> staticName: "FSObjType",<br /> value: 0<br /> },<br /> {<br /> op: "IsNull",<br /> staticName: "MyDollars"<br /> }<br /> ]<br /> });<br /> <br /> $("#QueryOutput").val( viewXml );<br /><br /> try {<br /> //Get the current client context<br /> this.spContext = new SP.ClientContext.get_current();<br /><br /> //Create local vars.<br /> var targetList = spContext.get_web().get_lists().getByTitle( listName ),<br /> camlQuery = new SP.CamlQuery();<br /> <br /> //Set CAML Query.<br /> camlQuery.set_viewXml( viewXml );<br /> //Cache listItems var for use later.<br /> this.listItems = targetList.getItems( camlQuery );<br /> //Load and execute queries.<br /> spContext.load( listItems /*'Include(Author,MultiSelectLookup,MyDollars)'*/ );<br /> spContext.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);<br /> } <br /> catch( e ) {<br /> console.log( e );<br /> }<br />}</pre><br /><p>This works as expected. Just for clarity my query above looks like this:</p><pre class="brush: xhtml; toolbar: false"><View><br /> <ViewFields><br /> <FieldRef Name='DateAndTime' /><br /> <FieldRef Name='MyDollars' /><br /> <FieldRef Name='MultiSelectLookup' /><br /> </ViewFields><br /> <Query><br /> <Where><br /> <And><br /> <Eq><br /> <FieldRef Name='MultiSelectLookup' LookupId='True' /><br /> <Value Type='LookupMulti'>4</Value><br /> </Eq><br /> <And><br /> <Eq><br /> <FieldRef Name='FSObjType' /><br /> <Value Type='Lookup'>0</Value><br /> </Eq><br /> <IsNull><br /> <FieldRef Name='MyDollars' /><br /> </IsNull><br /> </And><br /> </And><br /> </Where><br /> </Query><br /></View></pre><br /><p>When the executeQueryAsync is successful, it’ll call the ReadListItemSucceeded function. Pretty straightforward, nothing magical... What <strong><em>is</em></strong> magical, is finding a method that will display all of the JSON that has been returned. I can’t find it... I did <strong>*fix*</strong> that though. In the ReadListItemSucceeded function, I have a simple for loop, that expands and logs all of these properties. Here’s what that looks like:</p><pre class="brush: javascript; toolbar: false">function ReadListItemSucceeded(sender, args) {<br /> <br /> for( var i=0; i<listItems.$2_1.length; i++ ) {<br /> console.dir( listItems.$2_1[ i ].$4_0.$1F_0.$m_dict );<br /> }<br />//...-->SNIP<--...//<br />}</pre><br /><p><em><font color="#ff0000">***Please note: console.dir() didn’t make it into Internet Explorer until v9***</font></em></p><br /><p>This code will iterate through all of the JSON that is returned and display nicely in the console all of the data for each item. Here’s an example of 1 item that was returned in my JSON.</p><pre class="brush: javascript; toolbar: false">{<br /> DateAndTime : Wed Feb 22 09:00:00 EST 2012,<br /> MyDollars : null,<br /> MultiSelectLookup : [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<br /> _ModerationStatus : 0,<br /> _Level : 1,<br /> ID : 24,<br /> UniqueId : eeda73be-0e32-4d90-a461-2237ca2b1081,<br /> owshiddenversion : 2,<br /> FSObjType : "0",<br /> Created : Mon Jan 30 15:23:58 EST 2012,<br /> Modified : Sun Feb 12 14:01:49 EST 2012,<br /> FileRef : "/URL/Lists/GrandChild/24_.000"<br />} </pre><br /><p>Notice all of the extra columns? What’s up with that? It’s not as verbose as the Web Services, but I didn’t ask for all of this data, you know? </p><br /><h1><font style="font-weight: bold" size="5">What’s the fix for the hefty <ViewFields>?</font></h1><br /><p>Use Include(‘ColumnName’) within your .load() call. If you look above at my code sample, it’s commented out. I don’t know what exactly happens under the hood that makes the difference, but here’s a sample result from my console.dir() iteration.</p><pre class="brush: javascript; toolbar: false">{<br /> Author : [object Object],<br /> MultiSelectLookup : [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<br /> MyDollars : null<br />} </pre><br /><p>Now, I’m getting exactly what I want without any overhead data. Because of this behavior, I’m very much thinking of adding another method to <a href="http://robocaml.codeplex.com" target="_blank">roboCAML</a>, to make this easy to use.</p><br /><p>And if you were wondering... Using <ViewFields> and Include together do not mix! You will promptly receive an error.</p><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0EsSLBkwKsx89eG_S38XNWvPSV9tL7naxnQLN3umTqzkHozPILmxBStrWY6AC62DJGc18-TenmfxV_nKxjm1k_AP43Mn5nui_KbloKThTPgeloN0Z-PXhvcbKk-KHCqmrDwO53Yn06kct/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNhqaJzx6houQLAuoIuvaHyjBT4HQXF64YwBRWoaHru0L5VZzX3rROIPw2B4H5Eyo4YNUNcAz3XuPSYd5JGa5hJaAlpeHgspHbHhr8tcc84sfn79_vEWAaLDmWk8-paQh4GfsDKtHlZqWN/?imgmax=800" width="544" height="165"></a></p><br /><p>To get around this, my updated CAML looks like this:</p><pre class="brush: xhtml; toolbar: false"><View><br /> <Query><br /> <Where><br /> <And><br /> <Eq><br /> <FieldRef Name='MultiSelectLookup' LookupId='True' /><br /> <Value Type='LookupMulti'>4</Value><br /> </Eq><br /> <And><br /> <Eq><br /> <FieldRef Name='FSObjType' /><br /> <Value Type='Lookup'>0</Value><br /> </Eq><br /> <IsNull><br /> <FieldRef Name='MyDollars' /><br /> </IsNull><br /> </And><br /> </And><br /> </Where><br /> </Query><br /></View></pre><br /><p><font color="#ff0000"><em>ProTip: If you hate writing CAML, use <a href="http://robocaml.codeplex.com" target="_blank">roboCAML</a>... It’s free and has attractive qualities to the opposite sex.</em></font></p> Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1tag:blogger.com,1999:blog-4810971256241483630.post-30711335506855218282012-02-08T09:30:00.000-05:002012-02-08T10:05:36.307-05:00Understanding IncludeMandatoryColumns and SharePoint’s Web Services…<div dir="ltr" style="text-align: left;" trbidi="on">
For a while now this has baffled me and several other people I know whom use SharePoint’s web services religiously. The problem starts with <a href="http://msdn.microsoft.com/en-us/library/dd586530(v=office.11).aspx" target="_blank">incorrect documentation</a> and since it has never been updated, new people to SharePoint continue to have issues with <IncludeMandatoryColumns>. This post should give some clarity into what to expect when using this…<br />
<h3>
<IncludeMandatoryColumns>False</IncludeMandatoryColumns></h3>
When setting this to option to: False; you’d expect a whole bunch of columns to not show up in the results of the XML. That’s just, well: <span style="color: red;">FALSE</span><span style="color: black;">. The only thing that changes in your data set is the Title column. Nothing more, nothing less… Here’s a sample data set that was retrieved using <a href="http://spservices.codeplex.com/" target="_blank">SPServices</a> (which btw, you should use for all of your web service interactivities).</span><br />
<pre class="brush: xhtml; toolbar: false; highlight: [3]"><!-- Mandatory Columns = False -->
<rs:data ItemCount="1">
<z:row ows_MyDollars='567890.000000000' ows_Boolean='1' ows_MultiSelectLookup='' ows_ID='404' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='404;#{2541C25E-1D9A-4480-8F97-570B64077E37}' ows_owshiddenversion='3' ows_FSObjType='404;#0' ows_Created='2012-02-06 13:55:17' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-06 16:17:24' ows_FileRef='404;#mySite/Lists/GrandChild/TestFolder/TestSubFolder/MovedItem' />
</rs:data></pre>
<br />
Did you notice the <strong>owsHiddenVersion </strong>in the XML? According to the documentation, it should not be there. For posterity, here’s a screenshot of the parameters passed to SPServices. If you are keen, you’ll notice my <ViewFields> do not contain the Title column:<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_fC6gu-2dIq__JN3gadp-m0mvXtbdQ5Psc4FLFLWgyIz3xFRIeyNa6FEbb4OkUtMrZTevistF7GEe5G6r5LemZMMbs7sRVpKI2H1-eCSP-MPYPPTQvaUBkRPYYZ50m2HtDB6EMrvM4wdj/s1600-h/IncludeMandatoryColumns_False%25255B10%25255D.png"><img alt="IncludeMandatoryColumns_False" border="0" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9-WZvQa6hKNsNg9q7Fc7S7q5OXcBiRpguUz3gIhVMZuIreh5ZvBBBDVc6wknFXuGD4WwCfR_slgJCpKxidDuBSIJF7c_9YNd1pE2c3GEOS6-vqSy9SGj_q3WvqfHB-sgZNEHt_OzHM0vs/?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="IncludeMandatoryColumns_False" width="604" /></a><br />
<br />
<br />
<br />
<h3><IncludeMandatoryColumns>True</IncludeMandatoryColumns></h3>
So being coy and after a few trial and errors, I decided that <IncludeMandatoryColumns> had to be related to the required fields within the list. Since Title was the only required field, it seemed like a logical step. Within this list, I have a column called Hyperlink. I decided to make that required. Notice in my <ViewFields>, Hyperlink is not present nor is Title for that matter.<br />
<pre class="brush: xhtml; toolbar: false; highlight: [3]"><!-- Mandatory Columns w/ 2 columns required -->
<rs:data ItemCount="1">
<z:row ows_MyDollars='567890.000000000' ows_Boolean='1' ows_MultiSelectLookup='' ows_ID='404' ows__ModerationStatus='0' ows__Level='1' ows_Title='InSubFolder' ows_UniqueId='404;#{2541C25E-1D9A-4480-8F97-570B64077E37}' ows_owshiddenversion='4' ows_FSObjType='404;#0' ows_Created='2012-02-06 13:55:17' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-07 20:12:48' ows_FileRef='404;#mySite/Lists/GrandChild/TestFolder/TestSubFolder/MovedItem' />
</rs:data></pre>
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjb46lgd6M6nHa0t9CgkY1wgtHD6dyl07PhhmGN-BVUEs_xQhX5InqTb5zqYIzl_teVytCFLl95QPJkK4-WPW_HmuZIxDrWELMkU1ddYLKScqLtPScGyHgs3B5WHkNGlCCxAMVCqLalpm-/s1600-h/IncludeMandatoryColumns_True%25255B2%25255D.png"><img alt="IncludeMandatoryColumns_True" border="0" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBtgUxxMcM52J9Iag5IX1COUTa9WprVQORiCaxBC48v93UB6wa-oiArAK_CL-NtLhB44tBmeNKWVkvi6_fujcEOHjEPp5nFG1UpxvWY7bxMZqLL3JGray2_D-KEtp-PzVrH08J5vTjlsnU/?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="IncludeMandatoryColumns_True" width="604" /></a><br />
<br />
<br />
<br />
Is that ows_Title that I see? Why yes, <strong>YES IT IS</strong>! As a matter of fact, it’s the only thing that’s different from the two sets of XML.<br />
<h3>What have we learned?</h3>
<br />
<IncludeMandatoryColumns>True</IncludeMandatoryColumns> += Title. If Title is already in your <ViewFields>, then you’ll get nothing new. Yes, I know ID is in my <ViewFields> in the examples above. Nothing changes except Title.<br />
<br />
The documentation on MSDN is invaluable, however, it must be used with caution. I’ve been running into a few whammies, gotchas, kablooey your code is busticated situations while building <a href="http://robocaml.codeplex.com/" target="_blank">roboCAML</a>. The <a href="http://msdn.microsoft.com/en-us/library/ee557057.aspx" target="_blank">SP Namespace</a> is another beast altogether, but that’s not what this post is about… yet.</div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com1Takoma Park, MD, USA38.9778882 -77.007476538.953200200000005 -77.0469585 39.0025762 -76.967994499999989tag:blogger.com,1999:blog-4810971256241483630.post-2161159659744983892011-07-20T10:30:00.004-04:002016-06-29T23:26:19.575-04:00#SharePint this Saturday<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
The first virtual #SharePint will be taking place on <b>Saturday, July 23rd,
7:30 E.S.T</b>. @ <a href="http://www.thefirestation1.com/">http://firestation-1.com</a>.<br />
<b>Phone</b>: (301) 585-1370
<br />
<b>Address</b>:
<br />
8131 Georgia Ave.
<br />
Silver Spring, MD 20910<br />
<br />
<br />
If you want to participate, but cannot show up in person, join the hangout on
#GPlus @ <a href="http://gplus.ionline247.me/">http://gplus.iOnline247.me</a>
<br />
Hope to see you there!</div>
Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-53499239874781104542011-07-19T23:44:00.001-04:002011-07-20T00:05:03.913-04:00My thoughts on Twitter and Google Plus<p>Twitter can rebound from the blow Google has delivered and still keep their ecosystem, however, they do have a lot to account for. Let's look at <strong>Circles</strong>... <br /></p> <p>Circles seem very similar to Lists on Twitter. The primary difference is audiences. It's trivial to post on G+ to a particular audience. However on Twitter, it's black and white. You either tweet it public or you don't. I propose a different skew on the Retweet button. Wouldn't it be nice if you could Retweet to a particular list and the followers of that list would be the only people that could see that tweet? Sound familiar? I'm sure it does... Sounds like a G+ Circle to me. I'm sure there is something in the works over on Twitter as we speak to offer some of these capabilities BUT...</p> <p> <br />The inherent problem with doing so would mean an architectural change within Twitter. There in lies a major hurdle. Twitter relies for the most part, 3rd party applications to handle it's interface. I know this to be true because 99% of the tweets I read are from TweetDeck, HootSuite, SilverBird, Seesmic, to name a few... Most of the tweets are <b>not</b> from the web. <br />If Twitter changed it's API, then you will only be able to use the <i>new</i> features from the web. Rest assured, the applications would race to add in these new features, but that's another issue altogether: Application Cohesiveness. Why am I offered, as a user, a new capability but only able to use it via the web? I remember not too long ago, the API changed on Twitter to handle DM's in a different manner. That forced me to deal with an error in Silver Bird for several days until it was fixed. You can only imagine the disconnect I felt with Twitter over that period of time.</p> <p> <br />G+ has the upper hand in this arena. There's one point of contact, the web. There are mobile apps for the Droid and iPhone, but updates for these apps are pushed automatically by none other than Google themselves. How can you beat that? For right now, G+ is keeping the API closed and I agree with the decision. The masses must now how to use the system before 3rd party apps go bonkers with it. And this is just how Circles affects Twitter. Let's look at <b>Hangouts</b>...</p> <p> <br />There's NOTHING like it on Twitter. Nothing even close! If you have been following my stream, then you may have noticed me sharing my hangout sessions. Every time one has ended, I've shared it and commented on the quality and effectiveness. I've enjoyed it so much, that I'm putting together a <b>#SharePint</b> this Saturday and I'm going to stream the even through the G+ Hangout. I've heard some talk about this being a form of ChatRoulette, but seriously, USE IT! It's enabled my team to not only be more productive, but I've been able to actually meet/talk/share thoughts <a href="https://plus.google.com/116942460114088961682">Jim Bob Howard</a> without ever actually shaking his hand in person. The old adage comes to mind: Don't knock it, 'til you try it. Change is difficult, but as IT professionals, this shouldn't come as a surprise. Major change happens every three years or so. <b>Embrace it</b>.</p> <p> <br />So where does Twitter fit in my realm of social these days? I love SharePoint <period /> It's an excellent platform and in order for me to continue to learn and share my thoughts with the community, I must maintain my status on Twitter. There are a few people that I follow that are holding out and that's a concern for me. SharePoint's community collaboration was built on Twitter and I'm not sure if that's something that will change. Change is difficult, but I for one and tired of using DM's as an Instant Messenger. Twitter wasn't built for that... G+ was. Let's move to a more collaborative environment, since that's what we are all here doing...</p> <p>Just in case you were wondering, I did post this originally on <a href="https://plus.google.com/u/0/110508393702111689597/posts/5NCyRNm3Etx" target="_blank">G+</a>.</p> Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0tag:blogger.com,1999:blog-4810971256241483630.post-40777544371557884572011-04-22T19:26:00.001-04:002011-10-28T17:42:00.359-04:00The value of a $<div dir="ltr" style="text-align: left;" trbidi="on">
What really does happen when you type $ into your code? I know it’s magic, but what really is going on? I keep that in mind when doing anything with <a href="http://jquery.com/" target="_blank" title="jQuery">jQuery</a>. I always ask, is this the most efficient way to handle this task? No matter how far I’ve progressed, looking at code I’ve written in the past always makes me shiver. <strong>YOU SHOULD TOO! </strong>Everyday is a learning experience; finding new techniques and trying them out will catapult you to new levels.<br />
As I progress along finding the happy medium between jQuery and it’s parent: Javascript, I’m always looking for simple tweaks to optimize my code. I’ve taken the time out to show a simple example of two different ways to populate a drop down. Can you guess why the .append() method takes longer?<br />
<iframe src="http://jsfiddle.net/iOnline247/DJV9U/embedded/" style="height: 300px; width: 100%;"></iframe><br />
There’s a good reason why. During the for loop, each option is being appended to the select. That means I’m calling jQuery to work it’s magic <strong>EVERY</strong> time within this loop. In this example, the code literally has to traverse the DOM 100 different times. Even though each option is going to the same destination! So, let’s look at it this way. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKifZlr6a2kle6Eqt7U50H65_ooLtTKW2NepjW-oTbiWSCzgrg6ri1i4jmhNQJJNlLXfz71iqyX-KHKOyJHXE_FLEtNHYSlSYjTNZ8Y_J3lWqXLX4dhxfeDj5IbWI2ESPUaub9cP2KE2ve/s1600/fieryPit.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img align="left" height="136" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKifZlr6a2kle6Eqt7U50H65_ooLtTKW2NepjW-oTbiWSCzgrg6ri1i4jmhNQJJNlLXfz71iqyX-KHKOyJHXE_FLEtNHYSlSYjTNZ8Y_J3lWqXLX4dhxfeDj5IbWI2ESPUaub9cP2KE2ve/s1600/fieryPit.jpg" style="display: inline; float: left;" width="124" /></a>If you had to walk across a fiery pit barefooted multiple times, would you carry as much as you possibly could each time or would you continually make that trip over and over again? Personally, I’d run and not walk, but that’s just me… Hopefully, that makes some sense. Building an array full of the options and then traversing the DOM once, is infinitely more efficient. I only make a call into jQuery once. That’s an important distinction between these two techniques. Traversing the DOM using jQuery is a slow task in some regards, especially in the example above.<br />
Feel free to play around with the code sample provided and see if you can come up with some more techniques where this same logic can be applied. It may just save you some time…</div>Anonymoushttp://www.blogger.com/profile/03288345375198893987noreply@blogger.com0