SharePoint Blog - René Hézser

Anmelden  RSS Feed RSS Feed
Startet die Suche

Archive

Kategorien

Links

Andere Blogs



Add to Technorati Favorites

May 202008

Using the PropertyBag

A nice feature of a SPWeb, SPSite or SPWebApplication is the Properties Property. You can save information to this Hashtable.

e.g. webApplication.Properties["MyProperty"] = "5";

After a change to the PropertyBag, you have to webApplication.Update() the changes. But here comes the problem. The account updating the Properties has to be a member of the "Farm Administrators" group to be able to save the changes to the SPWebApplication, because you change a SPPersistantObject of your farm!

Additionally the account needs rights to 4 stored procedures in your config Database, which might not be set.

Permission Stored Procedure Database Role
EXECUTE proc_putObject WSS_Content_Application_Pools
EXECUTE proc_putClass WSS_Content_Application_Pools
EXECUTE proc_dropObject WSS_Content_Application_Pools
EXECUTE proc_getNewObjects WSS_Content_Application_Pools

 

Technorati Tags:

Published: 5/20/2008  2:14 PM | 2  Comments | 0  Links to this post
Tagged as: Development, SharePoint

May 202008

Adding SPTimerJob in a FeatureReceiver

In one of my solutions I wanted to add a SPTimerJob through a FeatureReceiver in the feature. The feature was scoped to "Web". I got an "Access denied" when I tried to do so.

The solution I found, was to create a second feature, which was scoped to "WebApplication". From within this feature, I was able to create my timer job. But only in FeatureActivated. When I tried to add the job from FeatureInstalled, I got the error that SharePoint did not find the assembly, even if it was installed to the GAC.

Sometimes SharePoint behaves strange...


Published: 5/20/2008  12:24 PM | 0  Comments | 0  Links to this post
Tagged as: Development, SharePoint

May 202008

Use JavaScript within a SPGridView

The NavigateUrlFormat property of the SPMenuField allows you to specify a Url, which will be called if you click the field in a SPGridView.

   1: SPMenuField colMenu = new SPMenuField();
   2: colMenu.NavigateUrlFields = "WebUrl,AlertID,ListID";
   3: colMenu.NavigateUrlFormat = "{0}/_layouts/SubEdit.aspx?Alert={1}&List={2};
   4: colMenu.TokenNameAndValueFields = "WEBURL=WebUrl,ALERTID=AlertID,LISTID=ListId";

With the TokenNameAndValueFields property, you map the grid columns to %xyz%.

If you want to use a JavaScript instead, you can do so:

   1: MenuItemTemplate editAlertMenu = new MenuItemTemplate("Name", "imageUrl");
   2: editAlertMenu.ClientOnClickScript = "editAlertScript('%WEBURL%','%ALERTID%','%LISTID%');";
   3: alertListMenu.Controls.Add(editAlertMenu);

The trick is, that you have to put a ' around the variables.

The JavaScript would be something like

   1: <script type="text/javascript">
   2: function editAlertScript(weburl, alertid, listid){
   3:    var url = weburl + '/_layouts/SubEdit.aspx?Alert=' + alertid;
   4:    if (listid.length > 0)
   5:    { url = url + '&List=' + listid; }
   6:    window.navigate(url);
   7: }
   8: </script>

 

Technorati Tags: ,,


Published: 5/20/2008  10:48 AM | 0  Comments | 0  Links to this post
Tagged as: Development, SharePoint

May 122008

Display all my alerts - Update

Just a small update for my Display all my alerts Webpart.

  • Handling search alerts is improved
  • the assembly will not install in the GAC (Global Assembly Cache) to get rid of the FullTrust setting in the web.config

Tags:


Published: 5/12/2008  12:38 PM | 0  Comments | 0  Links to this post
Tagged as: Webparts, Development, MyAlerts, SharePoint