NetworkedBlogs by Ninua
Add Your Blog
|
Login
|
Signup
2
followers
Blog with technical tips for Microsoft technologies.
Invite Friends to Follow
Syndication
Written by
1 Author
Chris Barba
Followed by
2 People
(
invite friends
)
Random Technical Thoughts
English -
Sharepoint
,
C#
,
Asp.Net
http://chrisbarba.wordpress.com
Unfollow
Follow
Random Technical Thoughts
· 5M ago
Updated – Search for string across all fields in all tables in a database
This is an update to a previous post. It has been updated to use table variables instead of temp tables. This helps when you are in an environment (like production) where you don’t have permissions to create/drop temp tables. DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(363
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
How to add a content editor web part to a SharePoint page
Here is some code to add a content editor web part to a page. So if you are creating a page in code (like during feature activation), then you put a content editor web part on the page. Setting the InnerText (contentXMLElement.InnerText = "";) will set the text in the content editor, incase you want
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
Method to strip out special characters from a string.
Special characters can cause all kind of trouble. So here is a method that you pass in a string and all the special characters will be removed. public static string StripSpecialCharacters(string stringToConvert) { stringToConvert = stringToConvert.Replace("~", string.Empty); stringToConvert = str
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
How to create sub sites in SharePoint 2007
Here is some code to create a subsite in SharePoint. The important part to remember is to set AllUnsafeUpdates (and unset), otherwise it won’t work. try { SPWeb webSite = SPContext.Current.Web; webSite.AllowUnsafeUpdates = true; //Add subsite site webSite.Webs.Add(<WEBURL>, <TITLE>, <DESCRIPTION>, L
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
Detect who the current user in a SharePoint web part
It’s easy to detect who the current authenticated in ASP.HET (HttpContext.Current.User), but that doesn’t work in a web part. So in a web part, you need to open a web and then you access the current user. Below is an example (you just have to specify the “SiteToOpen”). using (SPWeb webSite = SPCon
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
How to cache data in a SharePoint web part
Here is some sample code to cache a list of strings in a web part. List<String> documentNames = new List<String>(); object cacheddocumentNames = PartCacheRead(Storage.Shared, "DocumentNamesList"); if (cacheddocumentNames != null) { // cache exists, use it documentNames = (List<String>)cacheddocume
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
Programmatically set url field on list
I had to find a way to programmatically add items to list that has a url field. Here is an example of how to do it. When you set the field that is an URL you have specify a url a coma (and a space) and the value to display. using (SPWeb webSite = [...]
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
Create a SharePoint list of the States
Here is a method that will create a list of States in the US. It will create the list in the current site. private void CreateUSStateList() { SPContext.Current.Web.AllowUnsafeUpdates = true; SPWeb mySite = SPContext.Current.Web; SPListCollection lists = mySite.Lists; lists.Add(USStateList, "Li
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
Create a list of Countries for SharePoint
Here is a method to create a list and populate the list with the countries of the world. private void CreateCountryList() { SPContext.Current.Web.AllowUnsafeUpdates = true; SPWeb mySite = SPContext.Current.Web; SPListCollection lists = mySite.Lists; lists.Add(CountryList, "List of Countries"
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
Random Technical Thoughts
· 1Y ago
How to add a required field validator to a SharePoint web part.
You just have to set the ID property of the control, then set the control to validate to the ID of the control. Below is an example //Declare Controls private TextBox _txtFirstName = new TextBox(); RequiredFieldValidator _rfvFirstName = new RequiredFieldValidator(); //Add text box this._txtFirstName
0
Vote Up
0
Voted
·
Share
Are you sure you want to delete this?
Cancel
Yes, Delete Now
Deleting
Deleting
Facebook
Twitter
Email
More Stories
More