Reputation: 4688
Is there any way to automatically deploy Control Adapters (some menu modifications) in SharePoint using WSP solution and features ? Can I programmatically edit/deploy some ".browser" file?
If it is not possible what are the alternatives (some good practice) ?
I need this for Publishing site.
Upvotes: 0
Views: 1019
Reputation: 4517
Here is an article explaining this task. Your can add method like this to your master page class:
private static void AddControlAdapterToType<T>(Type controlType) where T : ControlAdapter, new()
{
if (controlType == null)
{
throw new ArgumentNullException("controlType", "This argument can not be null!");
}
var adapters = HttpContext.Current.Request.Browser.Adapters;
var key = controlType.AssemblyQualifiedName;
if (!adapters.Contains(key))
{
var adapter = typeof(T).AssemblyQualifiedName;
adapters.Add(key, adapter);
}
}
And then you call it from the Master Page constructor like this:
AddControlAdapterToType<YourCustomAdapter>(typeof(Microsoft.SharePoint.WebPartPages.ContentEditorWebPart));
Upvotes: 0
Reputation: 2292
In addition, with Features you always have the ability to define a FeatureReceiver which basically is callout to a developer provided assembly for handing Feature lifecycle events (e.e. onFeatureInstalled, onFeatureActivated, etc.) There you would be able to write .Net code to interact with the infrastructure.
Upvotes: 1
Reputation: 27455
you could give WSPBuilder a chance. It's a open source tool pack SharePoint solutions. I know with WSPBuilder you cloud definitely deploy files into the bin and resource folder within an application's directory (...\Inetpub\wwwroot\wss\VirtualDirectories\80).
So perhaps it is also possible to deploy files into the App_Browsers folder. I think it's worth a try.
Upvotes: 1