Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > SharePoint recipe problems
 

SharePoint recipe problems

Hi,

I'm writing a SharePoint 2007 recipe and have the following line of code within a value provider:

1
2 SPFarmlocalFarm=SPFarm.Local;
3
4 //Loopthroughtheservicesinthefarm
5 foreach(SPServiceoServiceinlocalFarm.Services)
6 {
7 //SeeifthisserviceisaSPWebService
8 if(oServiceisSPWebService)
9 {
10 //CastintoaSPWebService
11 SPWebServiceoWebService=(SPWebService)oService;
12
13 //Loopthroughthewebapplicationsinthewebservice
14 foreach(SPWebApplicationapplicationinoWebService.WebApplications)
15 {
16 try
17 {
18 if(!application.IsAdministrationWebApplication)
19 {
20 foreach(SPSitesiteinapplication.Sites)
21 {
22 sites.Add(newSiteInfo(String.Empty,
23 site.Port.ToString(),
24 site.Url));
25 }
26 }
27 }
28 catch(SPException)
29 {
30 //NotaSharePointsite
31 }
32 }
33 }
34 }

When the recipe executes the SPFarm.Local returns null. The odd thing is that within a Windows App this codes executes as expected.

Any suggestions?

Cheers,

Wes
Wes Hackett  Saturday, January 31, 2009 4:06 PM
Hi,

I don´t understandexactly the question.

Are you developing a GAX recipe that use sharepoint API ?

Could you execute the code from WinForm correctly ?



I had developed some webpart with the Sharepoint extension, and I don´tcompletely sure, but I think that you cann´t use the sharepoint API outside of sharepoint enviroment.
I think that the sharepoint API requires torun in the same AppPool where the sharepoint site is running.
The sharepoint extension (and sharepoit API) was developed to make easy the develop, for example, webpart.
I think that you cann´t use the sharepoint API from Winform or Guidance recipe.

in this post, you can see the problem with the AppPool:
http://forums.asp.net/p/991611/1289319.aspx


Perhaps, you would be able to use the sharepoint web service (.asmx)

SharePoint and Web Services

You can use it without security problems.


greetings
Leandro Tuttini
Leandro Tuttini  Saturday, January 31, 2009 6:37 PM
HiLeandro,

Thanks for the prompt reply :)

Yes this recipe is hooking onto the SharePoint API. The code sample will run as expected and get a reference to the local MOSS farm when executed in a winform application. Once i move the same block of code into a ValueProvider within my software factory it no longer works.

Having done some google-ing yesterday i think it might have something to do with the identity of the account that VS is using as you suggest. People were also pointing towards yet another x64 bit gotcha.

If i find a resolution i'll post it up on here.

cheers,

Wes
Wes Hackett  Sunday, February 01, 2009 8:28 AM

You can use google to search for other answers

Custom Search

More Threads

• Newb Question: Where to get started on item template and documentation
• Can't download GAT, GAX?
• Combining GAT and CAB
• SCSF April 2008 - Navigation issue in WPF view
• Approches for Copying files in solution folder
• Set an "Overview" HTML page to the Guidance Package
• Guidance Package versioning
• Add SchemaName to Web Service Software Factory or Data Access Guidance Package
• How to invoke GAT Recipes from XAML conetxt menu
• BizTalk Project Type