Saturday, March 31, 2007

Inserting a contact item in a Contacts Lists in a subsite through the UpdateListItems web service

First let me tell you that in order to use the list's web service in a subsite you have to add ?WSDL to the URI of the web service. Example: http://server/subsite/_vti_bin/Lists.asmx?WSDL. If you do not append ?WSDL you will not receive any error, but will operate with the web service of the top level site instead of the subsite and you will not find your list in the subsite.

We will use a Contacts List template to save our contacts. It let us to synchronize with MS Outlook 2007 in order to view these contacts in out Address Book. You can see a method to accomplish it:


static
bool insertContact(string company, string address, string name, string surname, string email, string phone, string language)

{


 

PCM.Lists list = new PCM.Lists();

list.Credentials = new System.Net.NetworkCredential("user", "P@$$w0rd");


 

System.Xml.XmlDocument doc = new System.Xml.XmlDocument();


 


XmlElement elBatch = doc.CreateElement("Batch");

elBatch.SetAttribute("OnError", "Continue");

elBatch.SetAttribute("ListVersion", "1");


 


XmlElement el1 = doc.CreateElement("Method");

el1.SetAttribute("ID", "1");

el1.SetAttribute("Cmd", "New");


 


XmlElement field1 = doc.CreateElement("Field");

field1.SetAttribute("Name", "Company");

field1.InnerText = company;


 


XmlElement field2 = doc.CreateElement("Field");

field2.SetAttribute("Name", "WorkAddress");

field2.InnerText = address;


 


XmlElement field3 = doc.CreateElement("Field");

field3.SetAttribute("Name", "FirstName");

field3.InnerText = name;


 


XmlElement field4 = doc.CreateElement("Field");

field4.SetAttribute("Name", "Title");

field4.InnerText = surname;


 


XmlElement field5 = doc.CreateElement("Field");

field5.SetAttribute("Name", "Email");

field5.InnerText = email;


 


XmlElement field6 = doc.CreateElement("Field");

field6.SetAttribute("Name", "WorkPhone");

field6.InnerText = phone;


 


XmlElement field7 = doc.CreateElement("Field");

field7.SetAttribute("Name", "WorkCountry");

field7.InnerText = language;


 


 

elBatch.AppendChild(el1);

el1.AppendChild(field1);

el1.AppendChild(field2);

el1.AppendChild(field3);

el1.AppendChild(field4);

el1.AppendChild(field5);

el1.AppendChild(field6);

el1.AppendChild(field7);


 


XmlNode rNode = list.UpdateListItems("Contacts", elBatch);


 


return
true;

}

Note: PCM is a Web Reference to our Lists.asmx web services.

Now you may synchronize the list with Outlook.

Related Links:

http://shlakapau.spaces.live.com/blog/cns!72ADBFE6717AFAF!107.entry

Thursday, March 29, 2007

KB932091 crashed my MOSS 2007

After an automatic update of WSS 3.0 my MOSS 2007 server crashed. I see these messages in my event viewer:

The message about the result of the installation was: Product: Microsoft Windows SharePoint Services 3.0 - Update 'Update for Microsoft WSS 3.0 (KB932091)' installed successfully.

The update cannot be started because the content sources cannot be accessed. Fix the errors and try the update again.

I solve it resetting the IIS.

Wednesday, March 21, 2007

SharePoint designer opens my site as a Web Site

It happens when you disable the Client Integation (Central Administration > Application Management > Authentication Providers > Edit Authentication). Then the site is opened as a normal web site and you cannot work with the SharePoint site properly.

Tuesday, March 20, 2007

Forms Server and the anonymous users

What would you do to enable forms server to unauthenticated users? When I have finished my form and tested it as anonymous user (as an authenticated user all works fine) I get an error when I submitted the form. My first idea was to follow the steps to enable the anonymous access to a list and submit my forms to this Document Library. But in SharePoint 2007 I could not grant access to lists to anonymous users. The only exception is the Surveys Lists (see the post in this blog).

The solution that I adopted was to change the submit option of my form. I published a web service that process the form and insert the form in a XML field on my database. If you want to save the form to a Document Library and avoid the database you can use the this web service or if you prefer you can store each field in a column of a Custom List extracting the fields of the form and insert in the list through the UpdateList web service published out-of-the-box by WSS 3.0

I also tried the solution exposed in post but it didn't work for me.

Related Links:

http://www.developer.com/services/article.php/3492456 (Web Service to process an InfoPath form)

http://support.microsoft.com/kb/927082/en-us (Enable anonymous access to a list)

http://www.sharepointblogs.com/ssa/archive/2006/11/30/16508.aspx (Upload files through web service)

http://jopx.blogspot.com/2006/08/using-webservices-in-browser-enabled.html (Forms Server)

http://weblog.vb-tech.com/nick/archive/2006/02/24/1453.aspx (WSS web services)

http://benreichelt.net/blog/2006/3/25/Insert-a-Sharepoint-list-item-from-web-services/ (Insert an item)


Thursday, March 8, 2007

Anonymous sites in MOSS 2007

One of the first problems I encountered when I began with SharePoint 2007 was the impossibility to show a list (doc lib, survey, pic lib, ...) to anonymous users. After configure the anonymous access for the site collection, site and list I only could show list to my authenticated users.

After googling I found the reason and the most important, the solution. By default the publish site collections ans all subsites has the LockDown mode on that makes that unauthenticated users cannot view lists.

The solution is simple, disable the LockMode. This action only will affect to the new sites that we create and the old sites still will continue with the LockMode on. To disable the LockMode you have to type:
stsadm -o deactivatefeature -url http://mysitecollection -filename ViewFormPagesLockDown\feature.xml

After that all sites created under the will have the LockMode off and theirs lists will be accessible by anonymous users.

Links:
http://technet2.microsoft.com/Office/en-us/library/f507f5d6-4c9d-4f98-909f-069c53b9a3f61033.mspx?mfr=true
http://www.sharepointplatform.com/teamblog/Lists/Posts/Post.aspx?List=427bfca2-b731-4c19-87c6-83c90460e02c&ID=29 (read until the end)

 
Online Visitors