Quame's Rampant Rants (QRR)

Icon

QRR

Adobe on the Ajax Wagon

I keep hearing Ajax to the extent that Im getting sick of it. Its like the developers opiom these days. But, I guess it really is. When you see major companies like MS, Google and now Adobe jumping onto the ajax wagon, then you know that things are getting serious. Adobe has it own version of Ajax library out (beta) but wait……before you say “I have seen all the Ajax libraries and they are basically the same” , just hold that thought and take a look at Adobe’s Ajax library (code name Spry) with an open mind. Its the best I have ever seen and their path is definatly very very different but yet the most practical. Adobes Ajax library allows you to use your familiar html elements, css and javascript to create your components or widgets (they call it). You will have to import the spry javascript library into your application.

By doing that, you get access to Spry html tags, elements and class like the repeat and region class and more.

Here is a link to check it out and browse through the examples http://labs.adobe.com/technologies/spry/.lets just say, its like bring mxml (flex) or xaml(WPF) but rather to the html community.

Check the demo’s out at http://labs.adobe.com/technologies/spry/demos/index.html

Filed under: Others

Using SP Webservice after using SP OM with minimal impact to code

So earlier in my post, I made not of some issues my team encountered when using the sharepoint object model in relation to authentication. Well, we still haven’t be able to figure out why using SP OM raises server authentication and using the Sharepoint webservice does not. In order for use to meet our deadline, we had to change all our data retrieval and updating code statements from using the OM to using a .net proxy webservice of the sharepoint site. That was a pain because all our existing code utilized the fact that all the rows and columns where in a form of collection (SPListCollection and SPListItems). So the question was how do we change our code with minimal impact since the webservice returns XML data. In response to this, I created a simple xmlToCollection class that parses the xml data from the sharepoint list data retrieval methods (Getlistitems) into a collection that can be used the same way as used using SP OM. Here is the code, feel free to use it

public class SPCollection
{

private List> collection;
public SPCollection()
{
collection = new List>();
}

public <!–[CDATA[ List<dictionary> ]]–> List”<”Dictionary”">” CreateCollection(XmlNode data)
{
XmlNodeList rows = XPathQuery(data, “//z:row”);
string key = null;
string value = null;
foreach (XmlNode row in rows)
{
Dictionary item = new Dictionary();

for (int i =0; i
{
key = row.Attributes[i].Name;
key = key.Remove(0, 4);

value = row.Attributes[i].Value;
item.Add(XmlConvert.DecodeName(key), value);

}
collection.Add(item);

}

return collection;

}

public static XmlNodeList XPathQuery(XmlNode xmltoquery, string xpathquery)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmltoquery.OuterXml);
XmlNamespaceManager mg = new XmlNamespaceManager(document1.NameTable);
mg.AddNamespace(“sp”, “http://schemas.microsoft.com/sharepoint/soap/”);
mg.AddNamespace(“z”, “#RowsetSchema”);
mg.AddNamespace(“rs”, “urn:schemas-microsoft-com:rowset”);
mg.AddNamespace(“y”, “http://schemas.microsoft.com/sharepoint/soap/ois/”);
mg.AddNamespace(“w”, “http://schemas.microsoft.com/WebPart/v2″);
mg.AddNamespace(“d”, “http://schemas.microsoft.com/sharepoint/soap/directory/”);

return doc.SelectNodes(xpathquery, manager1);
}

}

Once you have this going you can replace codes like

SPListItemCollection coll = Mylist.GetItems(query);
string Fname = coll[0]["First Name"]

with

XmlNode result = sharepontwebservie.GetListitems(“Mylist”,null,query,null,null,null,null);
SPCollection foo = new SPCollection();
<!–[CDATA[ List<dictionary> ]]–> List”<”Dictionary”">” coll = foo.CreateCollection(result)
string Fname = coll[0]["FirstName"]

So as you can see, the only only section where you have to make you changes is the part high lighted in green, everything else syntactically remains the same from there on ( in relation to accessing and setting data in the collection)

FYI: Take out the ” in List”<”Dictionary”">” statements before use.

Filed under: Others

knowledge worth knowing when using Sharepoint out-of-box webserive

Important things to note in relation to using sharepoint out-of-box webservice locatate at http://servername.com/_vti_bin/lists.asmx.

1. A GetlistItems call only returns filled colums of the rows. So if you do not have any data in column “First Name” in row 6, the xml return data will have all columns for row 6 except for the attribute “Firstname”.

2. Data returned from GetlistItems return will only represent the paging limit set on the veiw in sharepoint. Thats to say, if item limit propertiy on the list view is set to 100, and you have 1000 data in your list, the data returned by GetlistItems when no rowlimit parameter is set will equal 100 and not 1000. To get all the data (1000), either set the rowlimit to 1000 or more when calling GetlistItems or set the item limit property of the default list view on the Sharepoint site.

Filed under: Others

Windows SharePoint Services 3.0

Its being a long time since an posted anything out here. That just because im being busy with my current project on WSS beta 2.0 to TR. Technical Refresh (TR) was just released last week so if you are still interested, its still not too late to jump onto the beta testing wagon. For far, i have had a few fustration in relation to developing solution for the SP Plateform. The most prominent for me is security handling. Its seems SP security architeched has be redesigned and just doesnt work well as at now. It could be a bug or who know. In any case, here is the issue scenario just in case you are going this route. My application deals mainly in relaying data from SP to Adobe Flex application through which my client interacts with the data and updates are sent to sharepoint. I built a webservice wrapper around the SP Object Model using the Sharepoint.dll. My service impersonates an account that has all the rights to access the SP site as well as the SP db. Now for some reason, credentials are not passed from the wrapper class to SP making my application prompt for server authentication in order to access SP.I played around with the idea for awhile but due to project time constriant, i had to resort to using the WSS genereic List webservice located at http://servername.com/_vti_bin/lists.asmx. I will be posting some sample codes ads to accessing and massaging sharepoint data through the SP OM or webservice.

Filed under: Others

Del.icio.us