Mittwoch, 24. September 2008
Working with lists in Sharepoint 2007
i've come over an interesting white paper for querying data from sharepoint lists.
Different access-methods are explained (spquery, search, foreach,...).
Very Interesting is the well-known virtual limit with 2000 items per container (list/folder).
The document stands out, that this is "only" rlevant when viewing data with the default sharepoint ui in the browser.
If you plan to put an alternative ui on top of that, you're fine.
Here the link: http://technet.microsoft.com/en-us/library/cc262813.aspx
(There are also other white papers for capacity planning etc.)
happy querying ...
Dienstag, 1. Juli 2008
Cool STSADM Commands
http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html
Although this list exists a bit longer, thanks to Gary Lapointe for this helpful and huge list (my commands are there in, too :)).
I will soon update my list with a new command for running farm jobs not assigned to a site.
Mittwoch, 23. Mai 2007
My first Code Project Article - about Custom STSADM Commands
I've written an article about custom stsadm commands for SharePoint 2007 / WSS v3.
http://www.codeproject.com/useritems/stsadm_commands.asp
If you find the information useful, please let me know.
Montag, 21. Mai 2007
Custom Sharepoint Timer Job - Referencing Assemblies
I have written a custom Sharepoint Timer Job.
In that job i send emails for some items in a sharepoint list using the Ader TemplateEngine.
In my Project i referenced the assembly.
The deployment succeeded and as the job runs the first time, there was an error in the event log:
Could not load file or assembly ...... (i think you know the text :))
I was surprised because the assembly is deployed in the gac. Other projects use this assembly also on that server and can use it.
I don't know why but i copied the assembly to the web server extensions\12\bin folder where the owstimer.exe (That piece of executeable is responsable for executing the jobs) is living and this solved the problem.
Dienstag, 27. März 2007
Sharepoint Eventhandler updating fields for a document in a document library
I got a task where documents can be published to a document library. Published documents should get properties attached that are stored in a seperate custom list with a custom content type.
The documents derive all from that custom list content type.
So I wrote an eventhandler for an Updated and Added event to load all the fields from the custom list entry and if the document has also that fields, wrote the value.
At the end i just put in properties.ListItem.Update() and it updates the item. That was my development machine.
In production there came an error across: The document has to be checked out to update its properties. Ah, ok.
Because its only metadata in my mind and the user cannot control if the file gets checked out and i don't want to increment the version number i searched for an alternative method. I could'nt turn off "versioning" and "checkout requirement".
Long term, short answer: just call listItem.SystemUpdate(false).
This bypasses the "normal" checkout and list settings and just updates the item and does not increment the version number (if you use the second ctor with the bool. bool incrementListItemVersionNumber). BE SURE TO KNOW WHAT YOU DO :)
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx
Montag, 19. März 2007
Sharepoint Custom Application Pages
If you are one of those who want to add custom application pages to sharepoint, then the following infos might be useful:
- Put your aspx files in the _layouts folder (directly, not an sub folder)
- If you get errors, edit the web.config file in the _layouts folder to allow debug and turn custom errors off. (not in the web.config of the sharepoint.app)
- Its easier to use incode aspx files rather than code behind files (perhaps someone could use a combination of this and the last item in this list)
- If you want the look and feel of other sharepoint pages use the application.master file
- This project might be useful: http://subliminalsystems.com/Downloads/ItemAuditing_Whitepaper.doc
- A different approach: http://ablog.apress.com/?p=1369
Whats left is that i want to use the Sharepoint User Controls like the other application pages but how do i do that?
Is this possible? Perhaps someone can tell me
UPDATE:
What works for me is to create a project under the _layouts folder and mark the aspx files as Build Action = none. Additionally i removed the iis application. it can compile but not debug but thats ok at the moment. Inline code files does'nt even call the Page_Load Event in my case.
Montag, 20. November 2006
The DatagridView readonly performance Control
In my current project, a winform application which searches addresses around different databases, i use the datagridview control
to display the found addresses.
I don't know how much results i get because that depends on the search criteria the user enters.
Already at results with a count of 1000 entries the performance of the grid is bad.
For example, if i sort the datasource with the click on one of the columns it needs 20-30 seconds.
Thats not really acceptable.
So i searched a little bit around and found cool results in dependency to the "virtual mode" property.
If you bind data to the datagrid with virtual mode set to true the datagrid asks for the data that should be displayed,
and ONLY that data.
Behind the scenes i have a datatable which holds my search results.
The "ask for data" is an event called "CellValueNeeded" and gives me an cell- and a rowindex.
Easy with the datatable.
Sorting is even more easy: call the datatable.DefaultView.Sort property and you're done.
CODE START
//binding the data
//this causes the datagridview to raise the CellValueNeeded Event
dataGridView1.VirtualMode = true;
dataGridView1.RowCount = currentDataView.Table.Rows.Count;
//CellValueNeeded Event
DataRow needeRow = currentDataView[e.RowIndex].Row;
if (needeRow != null && needeRow[e.ColumnIndex] != null)
e.Value = needeRow[e.ColumnIndex];
else
e.Value = System.DBNull.Value;
//Sorting
currentDataView.Sort = string.Format("[{0}] {1}", currentSortColumn, sortOrder);
CODE END
And the performance is amazing: click and get immediately results. very cool...
Summary: If you have more or an unknown amount of data to display, use the virtual mode.
You have to sort manually, set the sortglyph to the column you are sorting and give the datagridview the data it needs.
in my case i have a readonly datagrid, for editmodes enabled you have to do a little bit more :)
Some links to articles about it:
Presenting Data with the DataGridView Control in .NET 2.0
http://www.awprofessional.com/articles/article.asp?p=446453&seqNum=1&rl=1
Virtual Mode in the Windows Forms DataGridView Control
http://msdn2.microsoft.com/en-us/library/ms171622(VS.80).aspx
How to: Implement Virtual Mode in the Windows Forms DataGridView Control
http://msdn2.microsoft.com/en-us/library/2b177d6d.aspx
happy displaying ...
tingle