However I have found a solution that does and will post a later article.
Adding BDC Columns to a Sharepoint List Programatically
However I have found a solution that does and will post a later article.
Random outpourings of a software developer
The first component is a boo script:
This requires the Boo.Lang.Dll and needs to be compiled with the boo compiler booc (booc warmup.boo)
==== warmup.boo ======
import System.Net
def warmup(url as string):
request = WebRequest.Create(url)
request.Credentials = CredentialCache.DefaultCredentials
request.Method = “GET”
response = request.GetResponse()
response.Close()
for url as string in argv:
print(url)
warmup(url)
The second component is a batch file:
==== Warmup.bat ====
@cscript iisapp.vbs /a MyAppPool /r
@Start /min warmup http://myurl:50002/page1.aspx http://myurl:50002/page2.aspx
@Start /min warmup http://myurl:50002/page3.aspx
These should save you hours of waiting around for SharePoint at the cost of a little bit of load. Beware I am unable to test the first line of the script as I am not currently at a W2k3 box. It recycles a given app pool.
The following is the code from a feature receiver event.
This allows a page to be added to a sharepoint site without using a page library.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWeb web = properties.Feature.Parent as SPWeb;
FileStream fStream = File.OpenRead(properties.Definition.RootDirectory + \NewPage.aspx);
Web.AllowUnsafeUpdates = true;
SPFolder folder = web.GetFolder(“”);
Folder.Files.Add(“NewPage.aspx”, fStream);
fStream.Close();
}
I am trying to add BDC columns to a sharepoint list programatically.
In fact the application that I am working on has 140 lists each potentially with a different set of BDC extension columns.
This is of course impossible – at least no-one is saying how to do so on the blogs.
You cannot use the simple field constructor as business data is not in the enumeration.
The trick is to extract the XmlSchema from the field and remove the offending gumph (that is the specific guids – which I now think may be the cause of my problems).
There are two methods that I have found useful:
SPField.AddFieldAsXml is the key method on the list to allow the xml to be added.
You need to tell the client which bdc provider to use:
SqlSessionProvider.Instance().SetSharedResourceProviderToUse(“myssp_id”)
This almost works (the fields are added, you get a cryptic error about looking in the logs yet the bdc column does not work).
I suspect that the guids that I removed are the problem.
Normally I only post working examples – this is not one of them.
I am little concerned at how verbose and unreadable the rules file is…
It is something that you need to get to work if you ever have a windows process that wants to perform an action on a users behalf under that users identity. It is a bit of a pig to configure. The only clue that you get is that the remote service is accessed using the Unknown User
Here is an article on enabling Kerberos.
Here is a Microsoft article on troubleshooting Kerberos under IIS.
Here is an article on the BDC and authentication. The BDC is the expensive version of Sharepoint’s datasource abstraction layer (i.e. it can read from a system that supports .net 2 ado.net drivers or has a web service interface).