Today I ran into a stupid problem: For a company I am working on webparts that support localization. The styles are generated dynamically, depending on the amount of items to show in a table. When using the English regionsettings, everything worked fine, but when switching to another region, for example Dutch, whole my table was screwed up. After comparing the html source files by hand, the sources were completely the same!
Then I decided to use a tool, named winmerge (i love that tool!). That tool showed me that the styles that were generated, did differ! With the dutch region settings, the style that was generated for my cells, had a relative percentage with a "," in it, while in english it was a ".".
dutch: style="left:8,34%;"
english: style="left:8.34%;"
maandag 6 oktober 2008
woensdag 23 juli 2008
Infopath: "generate" a unique number for your document
Last week I was busy on an infopath form for a sharepoint document library in combination with an approval workflow. I was wondering how to generate a simple, unique number to make sure that my document wouldn't overwrite other documents with the same title.
After a bit experimenting, I came across the following solution:
- Generate a new data connection to retrieve data from a sharepoint document library.
- make sure to select 'ID' from the specified document library
- make sure to get all data, not only the data for the current document.
When storing the document, create a button with the following ruleset:
-Query the data connection that you just created
- insert a function to compute the max(@ID) + 1, this is the highest available ID in the sharepoint lib + 1, so its always unique.
- add it in front or in the end of your title
- save & close ;)
After a bit experimenting, I came across the following solution:
- Generate a new data connection to retrieve data from a sharepoint document library.
- make sure to select 'ID' from the specified document library
- make sure to get all data, not only the data for the current document.
When storing the document, create a button with the following ruleset:
-Query the data connection that you just created
- insert a function to compute the max(@ID) + 1, this is the highest available ID in the sharepoint lib + 1, so its always unique.
- add it in front or in the end of your title
- save & close ;)
donderdag 12 juni 2008
Granting full access to a user on all site collections within a web application
Today i got a question from a colleague about how to grant full access to a user on all existing site collections. This is not the first time that i got that question, so i decided to put a small blogpost covering this subject.
It's quite easy to do, you just have to now how:
Go to SharePoint Central Administration.
Click on the Application Management tab.
Under Application Security click on Policy for Web Application
Click Add Users
Confirm your settings on the screen (defaults should be what you want) and click Next
Now enter your user or group of users
Click the box beside Full Control – Has full control.
Click Finish
Piece of cake, isnt it?
It's quite easy to do, you just have to now how:
Go to SharePoint Central Administration.
Click on the Application Management tab.
Under Application Security click on Policy for Web Application
Click Add Users
Confirm your settings on the screen (defaults should be what you want) and click Next
Now enter your user or group of users
Click the box beside Full Control – Has full control.
Click Finish
Piece of cake, isnt it?
vrijdag 6 juni 2008
Iterating through user profiles
some time ago i wrote an article about iterating through user profiles for non-admins (click here).
Today, i had the same problem, but my solution that was given, isnt optimal. I had to iterate through about 50.000 user profiles, that was a bit slow ;) And, only administrators could iterate through those profiles, even RunWithElevatedPrivileges didnt work.
I am glad that Microsoft hotfixed this problem (on the 8th of may 2008), you can download it here:
KB 952294. Now everyone can iterate through user profiles..
Today, i had the same problem, but my solution that was given, isnt optimal. I had to iterate through about 50.000 user profiles, that was a bit slow ;) And, only administrators could iterate through those profiles, even RunWithElevatedPrivileges didnt work.
I am glad that Microsoft hotfixed this problem (on the 8th of may 2008), you can download it here:
KB 952294. Now everyone can iterate through user profiles..
dinsdag 20 mei 2008
restoring Inheritance
For my current project, I used Tzunami to migrate all the WebApps, SPSite and SPWeb structures. But I had one problem: the site owners werent allowed to view the lists and listItems on their sites anymore: this was due to the fact that Tzunami doesnt inherit SPRoleAssignments from the parentSite when migrating the items.
Following code resets the inheritance:
Following code resets the inheritance:
dinsdag 13 mei 2008
Starting Sharepoint 2007 development
Paul Andrew has made a blog entry with good information on starting sharepoint development.
It provides links to courses, free online courses by microsoft, MCTS exams and a sample program. It's good information for everyone who wants to start sharepoint development!
url: http://blogs.msdn.com/pandrew/archive/2008/05/01/getting-started-with-sharepoint-development.aspx
It provides links to courses, free online courses by microsoft, MCTS exams and a sample program. It's good information for everyone who wants to start sharepoint development!
url: http://blogs.msdn.com/pandrew/archive/2008/05/01/getting-started-with-sharepoint-development.aspx
dinsdag 29 april 2008
More about events
As I had problems with the way events worked, I wanted to know more about the way they worked. below is bit of information about events that is good to know:
Two different kinds:
There are two different kinds of events: Synchronous and Asynchronous events.
* Synchronous events
- End with -ing (ItemAdding, ItemUpdating)
- Block the code as long the events arent finished
- Can (thus) make use of Session vars (HttpContext.Current is available)
- Can be used to prevent the event being finished. For example, with the ItemUpdating event you can verify the content being updated. Is the update not valid, the SPItemEventProperties.Cancel can be set to true and the SPItemEventProperties.ErrorMessage can be filled with an error message. This error message will not be displayed, but is written to the logfile. An error page will appear.
- dont contain the SPListItem in it's SPItemEventProperties (well, in the case of ItemAdding, that is, I didnt test it for the other events), so when you want to make changes to any of it's field you need to make use of the SPItemEventProperties.AfterProperties (see message below).
* Asynchronous events
- End with -ed (ItemAdded, ItemUpdated)
- Dont block the code.
- Can't (thus) make use of the Session (HttpContext.Current is null)
- Can't be reverted; When these events are fired, the item is already added, updated or deleted.
- contains the SPListItem. Changes can be made if you want to. This fires the (for example) ItemUpdating and ItemUpdated event. This can be turned off by using this.DisableEventFiring();
When creating a new list, events like FieldAdded and FieldAdding are not fired!
Two different kinds:
There are two different kinds of events: Synchronous and Asynchronous events.
* Synchronous events
- End with -ing (ItemAdding, ItemUpdating)
- Block the code as long the events arent finished
- Can (thus) make use of Session vars (HttpContext.Current is available)
- Can be used to prevent the event being finished. For example, with the ItemUpdating event you can verify the content being updated. Is the update not valid, the SPItemEventProperties.Cancel can be set to true and the SPItemEventProperties.ErrorMessage can be filled with an error message. This error message will not be displayed, but is written to the logfile. An error page will appear.
- dont contain the SPListItem in it's SPItemEventProperties (well, in the case of ItemAdding, that is, I didnt test it for the other events), so when you want to make changes to any of it's field you need to make use of the SPItemEventProperties.AfterProperties (see message below).
* Asynchronous events
- End with -ed (ItemAdded, ItemUpdated)
- Dont block the code.
- Can't (thus) make use of the Session (HttpContext.Current is null)
- Can't be reverted; When these events are fired, the item is already added, updated or deleted.
- contains the SPListItem. Changes can be made if you want to. This fires the (for example) ItemUpdating and ItemUpdated event. This can be turned off by using this.DisableEventFiring();
When creating a new list, events like FieldAdded and FieldAdding are not fired!
Abonneren op:
Posts (Atom)