I was just browsing on the Internet and then I found this really interesting post wrote by Rob Garrett:
http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/
Interesting part about is that SPList.Items.Add method gets all items in the list before adding a new SPListItem. So you can use SPQuery class to do this. I am sure gonna test this :)
Monday, March 18, 2013
Programmatically get SmtpClient of SharePoint web application
It is necessary to set up SmtpClient.Host property if you want to send e-mail using System.Net.Mail namespace. This can be easily done using OutboundMailServiceInstance property like this:
string smtpURL = SPContext.Current.Site.WebApplication.OutboundMailServiceInstance.Server.Address;
Best ways to log errors in SharePoint
Hi everyone,
I did some digging about SharePoint error logging, because when you create some project you usually need to solve exception handling problems. I know there are some ways to log those errors (or whatever needs to be logged), but which one is the best or most suitable?
Here is short briefing of things I found and this ought to be good start point for this problem:
This article describes various types of logging and their purposes:
http://spmatt.wordpress.com/2012/02/06/error-logging-in-sharepoint/
If you want to find fast way to log into ULS, this is the solution:
http://zimmergren.net/technical/sp-2010-developing-for-performance-part-4-logging
Previous log technique has some problems with logging into "Product" column of ULS log, so here is workaround for that problem:
http://blog.mastykarz.nl/logging-uls-sharepoint-2010/
If I would summarize some of logging techniques I would say this(more is in the first arcticle ;)):
ULS Logging
Nice way to go, but not for sand-box solutions. So with new SharePoint 365 comes some difficulties. Some of them can be solved by Full-trust Proxy.
E-mail Logging
This is was reason why I did all this digging in the first place. You should be prepared for additional problems, if you choose go down this path. By additional I mean organizing, sharing and unreliable reporting problems. This just shouldn't be your only way to log something (trust me I know what I am talking about :-D )
List Logging
This sounds like a nice and smooth way to log something. I can imagine many projects where this is appropriate solution. And it is also SharePoint 365 friendly :). There is just one thing I am not sure of and feel free to change my mind, but what happens if something goes wrong with SPContentDB? I would say that whole situation would be present like nothing happened at all. Anyway here is nice example how to do this http://www.sharepointblogs.be/blogs/timmy/archive/2011/12/26/sharepoint-365-logging.aspx
Other techniques can be seen in the first article...
At the and I would consider to have at least two ways error logging. That sounds like appropriate way to handle errors to me.
Anyway I hope you realized that this is just starting point for error logging and it will be useful to you ;)
Happy codding...
I did some digging about SharePoint error logging, because when you create some project you usually need to solve exception handling problems. I know there are some ways to log those errors (or whatever needs to be logged), but which one is the best or most suitable?
Here is short briefing of things I found and this ought to be good start point for this problem:
This article describes various types of logging and their purposes:
http://spmatt.wordpress.com/2012/02/06/error-logging-in-sharepoint/
If you want to find fast way to log into ULS, this is the solution:
http://zimmergren.net/technical/sp-2010-developing-for-performance-part-4-logging
Previous log technique has some problems with logging into "Product" column of ULS log, so here is workaround for that problem:
http://blog.mastykarz.nl/logging-uls-sharepoint-2010/
If I would summarize some of logging techniques I would say this(more is in the first arcticle ;)):
ULS Logging
Nice way to go, but not for sand-box solutions. So with new SharePoint 365 comes some difficulties. Some of them can be solved by Full-trust Proxy.
E-mail Logging
This is was reason why I did all this digging in the first place. You should be prepared for additional problems, if you choose go down this path. By additional I mean organizing, sharing and unreliable reporting problems. This just shouldn't be your only way to log something (trust me I know what I am talking about :-D )
List Logging
This sounds like a nice and smooth way to log something. I can imagine many projects where this is appropriate solution. And it is also SharePoint 365 friendly :). There is just one thing I am not sure of and feel free to change my mind, but what happens if something goes wrong with SPContentDB? I would say that whole situation would be present like nothing happened at all. Anyway here is nice example how to do this http://www.sharepointblogs.be/blogs/timmy/archive/2011/12/26/sharepoint-365-logging.aspx
Other techniques can be seen in the first article...
At the and I would consider to have at least two ways error logging. That sounds like appropriate way to handle errors to me.
Anyway I hope you realized that this is just starting point for error logging and it will be useful to you ;)
Happy codding...
Subscribe to:
Posts (Atom)