Running PowerShell with ISA for SharePoint


Be sure to put this at the top:

 

Add-PSSnapin“Microsoft.SharePoint.PowerShell”

Categories: SharePoint or Custom Development | 1 Comment

Windows Server 2012 – All all access from the UAC


In order to run anything it seems like successfully in a dev environment, you will have to run the following in PS.

Set-ItemProperty -Path “HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System” -Name “EnableLUA” -Value “0”
shutdown -r -t 0

Categories: SharePoint or Custom Development | Leave a comment

SQL Query to get table/view column data types


You can use this to recreate a table based on a view/table:

DECLARE @TABLE VARCHAR(80) = ‘YOUR_TABLE_HERE’
SELECT COLUMN_NAME,
(
CASE WHEN CHARacter_maximum_length IS NOT NULL THEN UPPER(DATA_TYPE) + ‘(‘ + CAST(CHARacter_maximum_length AS VARCHAR(MAX)) + ‘)’
ELSE UPPER(DATA_TYPE) END
) DATA_TYPE
FROM information_schema.columns
WHERE TABLE_NAME = @TABLE

OR

If you want to just recreate the table do this:

SELECT * INTO TBL_TEMP FROM TABLE_NAME

Also to Cache data, do this:

TRUNCATE TABLE CACHE_TABLE_HERE
INSERT INTO CACHE_TABLE_HERE
SELECT * FROM SOURCE_DATA_TABLE_HERE
SELECT * FROM CACHE_TABLE_HERE

Categories: SharePoint or Custom Development | Leave a comment

Adding Items to your Quick Launch or Top Navigation Programmatically!


I had issues trying to research and find a way to add to my Quick Launch menu or my Top Navigation menu, programmatically.  This was a huge challenge.  One of my employees found this link: http://www.anmolrehan-sharepointconsultant.com/2011/09/sharepoint-working-with-quicklaunch.html.  This was something we were able to start out with to add items to the quick launch.  I further modified it as shown below, and hope this is something that you can use.

image

 

using System;

using System.Web.UI;

using System.Linq;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Navigation;

 

namespace SPQuickLaunchAddItemWebPart.VisualWebPart1

{

    public partial class VisualWebPart1UserControl : UserControl

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            CleanUpQuickLaunch(“My Header”);

            AddQuickLaunchItem(“My Header”, http://www.google.com/q=stuff”, “My Link Here”, http://www.google.com”);

 

            CleanUpTopNavigationBar(“My Header”);

            AddTopNavigationBarItem(“My Header”, http://www.google.com/q=stuff”, “My Link Here”, http://www.google.com”);

            AddTopNavigationBarItem(“My Header”, http://www.google.com/q=stuff”, “My Link Here1”, http://www.google.com”);

        }

 

        public static void CleanUpQuickLaunch(string header)

        {

            using (SPSite site = SPContext.Current.Site)

            {

                using (SPWeb web = site.OpenWeb())

                {

                    web.AllowUnsafeUpdates = true;

                    SPNavigationNodeCollection quickLaunch = web.Navigation.QuickLaunch;

 

                    // try to get quick launch header

                    SPNavigationNode nodeHeader = quickLaunch.Cast<SPNavigationNode>().Where(n => n.Title == header).FirstOrDefault();

 

                    //if header not found remove it

                    if (nodeHeader != null)

                    {

                        quickLaunch.Delete(nodeHeader);

                    }

 

                }

            }

        }

 

        public static void CleanUpTopNavigationBar(string header)

        {

            using (SPSite site = SPContext.Current.Site)

            {

                using (SPWeb web = site.OpenWeb())

                {

                    web.AllowUnsafeUpdates = true;

                    SPNavigationNodeCollection topNavigation = web.Navigation.TopNavigationBar;

 

                    // try to get quick launch header

                    SPNavigationNode nodeHeader = topNavigation.Cast<SPNavigationNode>().Where(n => n.Title == header).FirstOrDefault();

 

                    //if header not found remove it

                    if (nodeHeader != null)

                    {

                        topNavigation.Delete(nodeHeader);

                    }

                }

            }

        }

 

        public static void AddQuickLaunchItem(string header, string headerURL, string item, string url)

        {

            using (SPSite site = SPContext.Current.Site)

            {

                using (SPWeb web = site.OpenWeb())

                {

                    web.AllowUnsafeUpdates = true;

                    SPNavigationNodeCollection quickLaunch = web.Navigation.QuickLaunch;

 

                    // try to get quick launch header

                    SPNavigationNode nodeHeader = quickLaunch.Cast<SPNavigationNode>().Where(n => n.Title == header).FirstOrDefault();

 

                    //if header not found create it

                    if (nodeHeader == null)

                        nodeHeader = quickLaunch.AddAsFirst(new SPNavigationNode(header, headerURL, true));

                    nodeHeader.Update();

 

                    //try to get node item under header

                    SPNavigationNode nodeItem = nodeHeader.Children.Cast<SPNavigationNode>().Where(n => n.Title == item).FirstOrDefault();

 

                    //If item not found under heading then create it

                    if (nodeItem == null)

                        nodeItem = nodeHeader.Children.AddAsLast(new SPNavigationNode(item, url, true));

                    else

                        nodeItem.Url = url;

 

                    nodeItem.Update();

                    nodeHeader.Update();

                }

            }

        }

 

        public static void AddTopNavigationBarItem(string header, string headerURL, string item, string url)

        {

            using (SPSite site = SPContext.Current.Site)

            {

                using (SPWeb web = site.OpenWeb())

                {

                    web.AllowUnsafeUpdates = true;

                    SPNavigationNodeCollection topNavBar = web.Navigation.TopNavigationBar;

 

                    // try to get quick launch header

                    SPNavigationNode nodeHeader = topNavBar.Cast<SPNavigationNode>().Where(n => n.Title == header).FirstOrDefault();

 

                    //if header not found create it

                    if (nodeHeader == null)

                        nodeHeader = topNavBar.AddAsFirst(new SPNavigationNode(header, headerURL, true));

                    nodeHeader.Update();

 

                    //try to get node item under header

                    SPNavigationNode nodeItem = nodeHeader.Children.Cast<SPNavigationNode>().Where(n => n.Title == item).FirstOrDefault();

 

                    //If item not found under heading then create it

                    if (nodeItem == null)

                        nodeItem = nodeHeader.Children.AddAsLast(new SPNavigationNode(item, url, true));

                    else

                        nodeItem.Url = url;

 

                    nodeItem.Update();

                    nodeHeader.Update();

                }

            }

        }

    }

}

 

 

Categories: SharePoint or Custom Development | Leave a comment

GridView and Sorting


GridView Control

Please reference this: http://tablesorter.com/docs/ for the actual source.

Step 1: Add the following to the ASP code:

(Note, you will want to copy the js and css files to a local network server, I am just using the source)

<script type="text/javascript" src="http://tablesorter.com/jquery-latest.js"></script&gt;

<script type="text/javascript" src="http://autobahn.tablesorter.com/jquery.tablesorter.js"></script&gt;

<link rel="stylesheet" href="http://tablesorter.com/themes/blue/style.css&quot; type="text/css" media="print, projection, screen" />

Step 2: Add the following JavaScript/JQuery code to your ASP code

(This will go after the code above, however the first $(document).ready command is fired for the first time the page is rendered. The second one is for if you are using AJAX Update Refresh Panels) If you are not populating the GridView on load, omit the first $(document.ready)

<script type="text/javascript">

try{

Sys.Application.add_init(appl_init);

$(document).ready(function () { $(<%= grdCaseInfo.ClientID %>).tablesorter(); });

}

catch(err){

}

function appl_init() {

try{

var pgRegMgr = Sys.WebForms.PageRequestManager.getInstance();

pgRegMgr.add_endRequest(EndHandler); }

catch(err){

}

}

function EndHandler() {

try{

$(document).ready(function () { $(<%= grdCaseInfo.ClientID %>).tablesorter(); });

}

catch(err){

}

}

</script>

Step 3: Add your GridView

(Please note, the CSS Class "tablesorter" must be used)

<asp:GridView ID="grdCaseInfo" runat="server" EnableModelValidation="True"

class="tablesorter" AutoGenerateColumns="False">

<Columns>

<asp:BoundField DataField="ID" HeaderText="Case" />

<asp:BoundField DataField="CaseTitle" HeaderText="Title" />

</Columns>

</asp:GridView>

Step 4: Add Code

(Use what ever code you need)

private string ConnectionString = "Data Source=.;Initial Catalog=CMS_InfoDept;Persist Security Info=True;User ID=cmsuser;Password=pass@word1";

protected void Page_Load(object sender, EventArgs e)

{

BindGridView();

}

private void BindGridView()

{

List<Case> cases = new List<Case>();

using (CMSDataContext db = new CMSDataContext(ConnectionString))

{

var dbResults = from q in db.tblCases

where q.caseOwnerID == 2

select q;

foreach (var dbItem in dbResults)

{

Case caseItem = new Case();

caseItem.ID = dbItem.ID;

caseItem.CaseTitle = dbItem.caseTitle;

cases.Add(caseItem);

}

this.grdCaseInfo.DataSource = cases;

this.grdCaseInfo.DataBind();

}

}

}

Step 5: Ensure the GridView has a HR row

(Adding the following code after you perofrm a DataBind() will ensure that your table will have hr that is required by the jQuery)

// This is required for all sorting on this gridview

if (grdCaseInfo.Rows.Count > 0)

{

// This replaces <td> with <th> and adds the scope attribute

grdCaseInfo.UseAccessibleHeader = true;

// This will add the <thead> and <tbody> elements

grdCaseInfo.HeaderRow.TableSection = TableRowSection.TableHeader;

}

Categories: SharePoint or Custom Development | Leave a comment

Adding a Modal Dialog link to the Quick Launch


Modify Your Quick Launch
First, modify your quick launch:

http://xxxxxxx/_layouts/quiklnch.aspx

Add a javaScript modal popup
Next, get the link of the item you want to add, and make sure it has the IsDlg=1 in the URL, add it as a link in the following format:
javascript:function tdql1(){SP.UI.ModalDialog.showModalDialog({url:’/xxx/Lists/xxx/NewForm.aspx?RootFolder=&IsDlg=1′,title:’Press Publication’})}tdql1();

Categories: SharePoint or Custom Development | 1 Comment

Capture Enter Key in ASP.NET’s Textbox


Here is some sample code on how to capture the enter key on a textbox in ASP.NET. I am posting this because I use it a lot.

function KeyDownHandler() {
if (event.keyCode == 13) {
event.returnValue = false;
event.cancel = true;
document.getElementById(‘cphmainContent_C008_LoginButton’).click();
}
}

Then add this to your textobox:
onkeydown=”KeyDownHandler();”

Categories: SharePoint or Custom Development | 1 Comment

SharePoint 2010 (And Office 2010) SP1 RTW


Microsoft Download Site: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26623

image

Categories: SharePoint or Custom Development | Leave a comment

Office Web Apps–Unable to process the request.


So the strangest error came up in our environment today.

When users go to open excel documents, they get this message:
Unable to process the request.  Wait a few minutes and perform this operation again.

image

I did a trace in ULSLogViewer:

There was an error in communicating with Excel Calculation Services http://xxxxxx:12345/fc4fbe4d08ge4a5589e844e33e8d3c08/ExcelService*.asmx exception: An error has occurred. [Session:  User: domain\yyyyyyy].

This didn’t say a whole lot, so I went to IIS Manager (inetmgr) on the system.  I saw the service and the app pool looked like it was up and working fine.  However, it still didn’t work.

image

After performing an “IISRESET”, it worked juts fine.

Categories: SharePoint or Custom Development | 1 Comment

Microsoft SketchFlow–Great for wire framing UI’s


Microsoft Expressions Blend has some very useful functionality and I just wanted to share this.

Here is the overview for SketchFlow by Microsoft: http://www.microsoft.com/expression/products/sketchflow_overview.aspx

Jeff Rix who works with me created this in about 15 minutes within SketchFlow.  It is much better UI prototyping than Excel or Visio.

 

Assign Detentions (2)

I really suggest this application to anyone who is a BA or Developer.

Categories: SharePoint or Custom Development | Leave a comment

Kanban Kick-start Example


All,

SCRUM is GREAT with Agile programming, however; sometimes you need to change things up a bit.  Sometimes, you have a small enough team that you may need to combine SCRUM with Kanban.

Please see this site for Kanban starting material:

http://www.crisp.se/kanban/

and

Kanban kick-start example – Crisp

 

As you can see below, we have expanded our use of Kanban and have the “Great Ideas” board…

Next we use the Product Backlog as well as the development kanban board…

Taken from the PDF referenced above, see the following examples and rules.

image

And now the rules…

image

Categories: SharePoint or Custom Development | Leave a comment

Massive Document Management in SharePoint 2010


I get so many folks contacting me asking what do I recommend when storing massive amounts of files in SharePoint.  Using SP as a document management tool.  As a developer I recommend creating an application that will do this for them.  However I know the answer is “We have to use SharePoint” and that’s very true because of all of the built in features.

For this reason, I would like to recommend this approach to everyone:

  1. Have a staging document library that implements all the possible content types.
  2. Create many sites with its own content database, design this structure with the idea in mind that you will want to evenly split up your files
  3. Create a workflow that moves those files from a staging document library to one of the document libraries in another content database
  4. Design a new search screen and configure search to enable searching these libraries with the different content types as a drop down.  To do this, you may need to modify the XSLT
  5. Create several front end application servers (web apps) that will do nothing but crawl the site, leaving the other front end(s) usable and ready for user interaction.

Now, determine the size requirements for your content DB for now, and the length of your retention schedule in years but no more than 7 years.  Add up the length of all of your files, and ensure that you multiply that number by 10 if you have versioning turned on.

Because SharePoint 2010’s recommend content database size should be < 200 GB you might want to consider remote storage by using SQL’s FILESTREAM provider.  You will have to get it working and it’s a small chore.  Please reference this link to get started: http://technet.microsoft.com/en-us/library/ee748631.aspx

Build an application that will COPY (not move) your files from the old system to the new system.  Make sure you throttle the files.  Also make sure that you keep a detailed log about every file you COPY over.

It is also a great idea to keep the old system in place and for the life of the retention just in case you find any immediate issues in the future.  Maybe create a new DNS name for the legacy file server, but move the DNS to the new system if needed.

That’s my two cents.  If When I do something like this, I will blog about it!

Categories: SharePoint or Custom Development | Leave a comment

Cascading Drop Downs in SharePoint Lists


In this video I will create a set of cascading drop down fields using two other SharePoint lists.  This is a pretty common request, and it is fairly simple task to accomplish.

image

Categories: SharePoint or Custom Development | 1 Comment

Creating an InfoPath SharePoint List connecting to a Web Service


In this blog posting, I will take you step by step on creating an InfoPath Form that connects to a web service stored on another server (normally causing cross-domain issues).

The business need:

  • SharePoint List – A SharePoint List to hold SoE documents (Separation of Employment)
  • Employee’s Location Drop Down Box – The employees have different locations, but there are many locations they work at.  So we need a drop down box for the Employee’s Location, but this has to come from a database, I chose to create a web service as a proxy.
  • Employee’s List Populated – Based on the employee’s location, the list of employees should populate.
  • Auto Staff ID filled Out – When the employee is selected, the Staff ID should be filled out.

Here is the final result. 

image

 

Web Service Methods:

image

I created an ASMX service because I knew for sure that it would be compatible with Microsoft InfoPath for sure.  I didn’t want to create a WCF service that did this just to find out it didn’t work with InfoPath.

 

Rules:

  • When the form loads, the employee’s locations are populated using GetLocations in the web service
  • When the user selects the employee’s Location, the list of employee’s drop down box populates.
  • when the employee is selected, then the employee ID is filled out.
    Steps:
    First, you must select your web service after it has been deployed.

image

Next, convert all of your web service to a SharePoint connections library.  This will deploy all of your connections and allow your InfoPath to use it directly.

image

Now, you must ensure that cross domain settings are turned to allow in InfoPath Form Services.  In Central Admin, go to General Application Settings, then Configure InfoPath Form Services…

image

Next, turn on Allow for Cross-Domain Access for the User Form Templates, this enables you to use a separate server for the web service.

image

To enable rules, you will need to right click on one of your controls, then select Rules and Manage Rules…

image

For the first field, Employee’s Location, you will have to set up rules so once it is selected your InfoPath form performs an action, and that is to:

  1. Set the GetEmployeesNameByLocation location field to the selected Employees Location field
  2.              image   

                 image

  3. Perform the query on GetEmployeesNameByLocation
  4.               image

      Now, your rules should look like this:

    image

    And by this time your Employee’s drop down should be populated.

     

    I will not take you through the rest of the examples to get to this point, but please let me know if you have questions, I can fill out more to my blog if questions arise.

     

    Bill.

    Categories: SharePoint or Custom Development | 2 Comments

    Exporting all users from Active Directory.


    You can export all users to a CSV file from Active Directory using a tool called CSVDE, it comes with Windows Server 2003, 2003 R2, 2008, and 2008 R2.  It also comes in the RSAT pack for Windows 7 (shown on my blog post here). 

    Its really simple,

    1. Go to Start
    2. Go to RUN (if required)
    3. Type in CMD to get to the command prompt
    4. Type in CSVDE –f <filename> –S <dccontroller>
      image

    Now you can import this into excel.

    Categories: SharePoint or Custom Development | Leave a comment

    Using the SharePoint PeopleEditor in a GridView


     

    All I can say is WOW.   If something as simple as the PeopleEditor takes me a week to implement and that is with having two Microsoft Premier Support cases open on it, than once I figure it out its worth writing an article on it.

     

    My business requirement:

    • I need a grid view to have data bound to it, but the data won’t come until after a drop down list selects what data source it needs to use. 
    • The data source is created using a generics list object in the code behind. 
    • The PeopleEditor object must be an object where people can enter just a single name.
    • The gridview can range in size
    • It MUST be in an AJAX Update Panel

    See the example below of what it should look like once it is finished.

    image

     

    The problems I was facing… …And the solution…

    1. JScript Error: Microsoft JScript runtime error: The value of the property ‘PickerAdjustHeight’ is null or undefined, not a Function or object.

      image

      Solution: Add the following line to the control’s front end source above the ScriptManger
                    <script type="text/javascript" src="/_layouts/entityeditor.js"></script>

    2. JScript Error: Microsoft JScript runtime error: Thevalue of the property ‘StoreOldValue’ is null or undefined, not a Function object

      image

      Solution: Add the following line to the control’s front end source above the ScriptManger
                    <script type="text/javascript" src="/_layouts/entityeditor.js"></script>

    3. Error with the People Editor:
      The target ‘ctl00$m$g_1c88d7ea_ab45_4c52_92a6_d0402a2ec996$ctl00$GridView1$ctl04$PeopleEditor2’ for the callback could not be found or did not implement ICallbackEventHandler.

      image

      Solution: The solution for this is much more complicated, I will quickly try to explain what the problem is and  how to resolve it.

    First you have to understand that you can’t just add the PeopleEditor control to your GridView in the WYSIWYG editor, in fact, its not even in the tool box.  You must instead add it in code behind on each row that exists.

    When you start out with an empty grid, then populate it within in runtime, you will notice there are some missing javascript functions that the gridview uses.  So you must first some how find a way to get those functions in the page when it renders.  But there is only one path that I have found that allows you to do it.  I have layed it out in VISIO so you can see what it looks like.

    image

    This solved my issue with this, and here is the samples.  If anyone wants a copy of my solution, please enter a post on it with your email, and I would be happy to send it to you.

    image

    image

     

    Bill.

    Categories: SharePoint or Custom Development | 89 Comments

    Adobe PDF Files are only allowing you to Save or Cancel, but not Open


    image

    If you want SharePoint 2010 to open the PDF file from within Internet Explorer, follow the instructions below:

    From Central Administration, go to Manage Web Application under Application Management…

    image

    Select your web site, then choose General Settings, and again General Settings…

    image

     

    Select the browser file handling to Permissive.

    image

    Now you can open PDF’s in your browser, even after hitting F5 to refresh, I had to hit Control + F5 to hard refresh to get it all to work.

    Categories: SharePoint or Custom Development | Leave a comment

    DropDown Change Event in GridView row


    I ran across a great blog that shows how to do some pretty cool stuff with the Drop Down within gridviews.

    http://weblogs.asp.net/vikram/archive/2008/04/17/handling-dropdown-list-inside-gridview-with-autopostback.aspx

    protected void dropdownlist1_SelectedIndexChanged(object sender, EventArgs e) {
    // get reference to the row
    GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer);

    // Get the reference of this DropDownlist
    DropDownList dropdownlist1 = (DropDownList) gvr.FindControl("dropdownlist1");

    // Get the reference of other DropDownlist in the same row.
    DropDownList ddlParagraph = (DropDownList) gvr.FindControl("ddlParagraph");
    }

     

    Bill

    Categories: SharePoint or Custom Development | Leave a comment

    SharePoint – 403 for only some users, some pages!


    I have been getting the following error for only some users, and on some pages that has a web part that I created that checks for their username information.

    403 Forbidden – The website declined to show this page, most likely cause, this website requires you to log in

    Yes, I tried logging out and logging back in.  I have tried everything….

    Here is my code:

    SPSecurity.RunWithElevatedPrivileges(delegate()
        {

            Microsoft.SharePoint.SPSite site = Microsoft.SharePoint.SPContext.Current.Site;

            Microsoft.SharePoint.SPServiceContext context = Microsoft.SharePoint.SPServiceContext.GetContext(site);

            // Uses the profile manager that was set up in Central Admin
            Microsoft.Office.Server.UserProfiles.UserProfileManager profileManager = new Microsoft.Office.Server.UserProfiles.UserProfileManager(context);

            if (impersonate.Length == 0)
            {
                // Used this, but there is no difference: staffMember = SPContext.Current.Web.CurrentUser.LoginName.ToString();
                // Used this, but there is no difference: staffMember = System.Web.HttpContext.Current.Request.ServerVariables["AUTH_USER"];
                staffMember = HttpContext.Current.User.Identity.Name;
            }
            else
            {
                staffMember = impersonate;
            }
        });

    Regardless of the different combinations I tried, I got this error only for some users, and only on some of the pages. So far my trend has only been the web part I created with this code. If I bypass that code (and I have a query string that allows me to impersonate a user) it will work just fine

    Here is the error:

    clip_image002

    So after about 8 hours of troubleshooting, I finally figured out it would work just fine if I added that user that was having issues to the Administrators Group on the local SharePoint server after performing an IISReset.

    So, after playing around a bit more I added “NT Authority\Network” (a local account) as a local admin instead of the user that was having a problem, performed an IISReset, and it worked as it should now for that user and all of the affected users.

    image

    I am waiting to hear back from Microsoft to see if this is a recommended solution to the issue, or if there is a better practice solution that I should be following.

    I will keep this post updated.

    Categories: SharePoint or Custom Development | 4 Comments

    Showing a dialog in SharePoint 2010


    To show a dialog in SharePoint 2010 simply call the OpenPopUpPage() method with the URL as the parameter.  This will look something like this…

    <a href="javascript:OpenPopUpPage(‘/pages/test.aspx’);">Show this page…</a>

    clip_image001

    NOTE: Be sure to specify the CSSClass “sp-notdlg” in anything that comes up that shouldn’t be coming up in your master page.  My modified ribbon toolbar came up for me, but it was able to suppress it in dialogs by adding the sp-notdlg tag to its css class attributes.

     

    Happy New Year!

    Categories: SharePoint or Custom Development | Leave a comment

    Create Custom Regular Expressions…


    Check this site out…

    It automatically creates your regular expressions that you like.

    http://www.txt2re.com/index-csharp.php3

     

    image

    Categories: SharePoint or Custom Development | Leave a comment

    Grouping (with Expansion/Collapse) a GridView in C# and ASP.NET or SharePoint


    Okay, so developing a UI is fun, especially when there is some challenges to it.

    The standard GridView is a very useful dynamic HTML table builder for your data, it can do a lot of different things.  But it is very limited!

    For example, if you were to create list that had multiple rows of data, and you wanted to group them by a category, you can’t… …unless that is you add some code.

    I took about 3 full days trying to come up with different ways that I can get this done, but I was finally able to figure it out.

    image

    Now, because I find it better practice, I always find it better to bind the data from the code-behind, rather than pulling in a database directly using the DataSourceObject from the UI.  This makes your application more expandable.

    Example:

    Sorry, the examples are in images mostly, I will try to format the code so that I can paste it in this form.  But this example I find it important to show where the code should be pasted.

    First, make a private list of a string, i called it ItemsToExpand, then initiate it.

    image

    Next, you will want to save the state of the items expand, and recall them if they contain any values…

    image

    Before saving the values, you will want to check if it is a postback, and if so, get the values from the EventArguments var that is passed back from the JavaScript client side.

     image

    Sort the list, set the data source to the DataGrid, then save the state of the ViewState “ItemsToExpand”

    image

    Here is what I used to sort the list…

    image

    Here is the code to create the columns and does all of the magic..

    protected override void Render(HtmlTextWriter writer)
    {
        Table table = (Table)this.GridView1.Controls[0];

        string lastCategory = string.Empty;

        foreach (GridViewRow row in GridView1.Rows)
        {
            int realIndex = table.Rows.GetRowIndex(row);
            string currentCategory = this.GridView1.DataKeys[row.RowIndex].Values[0].ToString();
            if (currentCategory != lastCategory)
            {
                GridViewRow groupHeaderRow =
                    new GridViewRow(realIndex, realIndex, DataControlRowType.Separator,
                       DataControlRowState.Normal);

                TableCell newCell = new TableCell();
                newCell.ColumnSpan = this.GridView1.Columns.Count; // <— Is not working…
                newCell.BackColor = System.Drawing.Color.FromArgb(233, 229, 229);
                newCell.ForeColor = System.Drawing.Color.DarkGray;
                newCell.Font.Bold = true;
                newCell.ColumnSpan = 4;

                bool itemFound = false;
                foreach (string item in this.ItemsToExpand)
                {
                    if (item.Trim() == currentCategory.Trim())
                    {
                        itemFound = true;
                        break;
                    }
                }

                string image = string.Empty;
                if (itemFound)
                {
                    image = "<img src=\"http:\\\\csapp2\\Discipline\\images\\nav_minus.gif\""
                    + " style=\"cursor:hand;\" onMouseUp=\"__doPostBack(‘__Page’, ‘Show|"
                    + currentCategory + "’);\">&nbsp;";
                }
                else
                {
                    image = "<img src=\"http:\\\\csapp2\\Discipline\\images\\nav_plus.gif\""
                    + " style=\"cursor:hand;\" onMouseUp=\"__doPostBack(‘__Page’, ‘Show|"
                    + currentCategory + "’);\">&nbsp;";
                }

                newCell.Text = image + this.GridView1.DataKeys[row.RowIndex].Values[1].ToString();

                groupHeaderRow.Cells.Add(newCell);

                table.Controls.AddAt(realIndex, groupHeaderRow);
                lastCategory = currentCategory;
            }
        }

        base.Render(writer);
    }

     

    Now, create a RowDataBound Event, and use the example code…

    image

    You can have multiple data key names, I used two of them in the aspx code.

    image

    Hope this helps!

     

    Bill

    Categories: SharePoint or Custom Development | 15 Comments

    Caching SSRS Reports


    This article explains how to have your SQL Server Reporting Service cache the report results.

    http://msdn.microsoft.com/en-us/library/bb283188.aspx

    I didn’t even know this was possible until I thought to myself how great it would be to see SSRS cache reports that run just a bit longer than normal.

    Here are the easy steps to do it.

    First, go to your reports application in your server…

    image

     

    Next select the reporting solution.

    image

    Now click on the dropdown to show the context menu, click Manage

    image

    Next click on the Processing Options:

    image

    Finally, set up the cache settings as you wish, I usually set the cache settings to every 30 minutes, this makes a huge difference.

    image

    Categories: SharePoint or Custom Development | 2 Comments

    SharePoint User Group Presentation


    There is a national users group meeting event monthly, and they asked if i could speak at it.  Here is a copy of the live meeting video from the SharePoint user group.

    I showed the old SharePoint site, and the New.

    http://s977.photobucket.com/albums/ae253/billsecond1/Professional/?action=view&current=livemeeting.mp4

    Categories: SharePoint or Custom Development | Leave a comment

    Storing a connection string safely


    Okay, first, I wanted to say a few things.

    1. Weather or not your connection string contains passwords: DO NOT EVER store your connection string in your code… …not even for just a moment!  Even if what you are coding is a web part.  In some companies this will lead to write ups and possible termination! 
    2. You must guard the web.config file by giving this area special access because often times it will contain really critical passwords.

    As you can tell from the above statements, that I have some experience things going wrong.  I have lost my temper so many times regarding people hard coding their connection string in the source code because it often contains passwords and the passwords are linked to so many other areas.  This is even bad if you have a source control system where once you change and remove the password from your code and do it the right way, it will still be in older versions of your code.

    You can use .NET Reflector to decompile source code, and here is a sample of what it looks like:

    image

     

    I wanted to show you the right way to do this.

    First navigate to your web config file…

    C:\inetpub\wwwroot\wss\VirtualDirectories\<sp site name:port name>

    image

     

    Add your configurationstring in your appSettings location under its own key/value pair:

    image

     

    Add the following to your code to get connectionstring.

    string connectionString = GetConnectoinString("YourDataConnectionStringKeyName");

    private string GetConnectoinString(string key)
    {
        string connectionString = string.Empty;

        SPSite site = SPContext.Current.Site;

        System.Configuration.Configuration
            config = WebConfigurationManager.OpenWebConfiguration("/", site.WebApplication.Name);
        AppSettingsSection appSettings = config.AppSettings;

        connectionString = appSettings.Settings[key].Value;

        return connectionString;
    }

     

     

    Additional security measures you can take is to encrypt your connection string, however I don’t really see the point because if a programmer wants your connectionstring they will get it via a unit test, or a breakpoint.  So if you don’t want your connection string to become parent to the programmers, you will want to use a different username password in the production environment, and only the person who should know the password should also have exclusive access to the SP Server.

    Hope this helps.  I really am not a mean guy as I may have sounded above, however this is one of my major pet peeves.

     

    Bill

    Categories: SharePoint or Custom Development | 2 Comments

    Web Parts: Get Current User with Impersonation


    Here is some code that I find myself using in all of my web parts.  You are also free to use it.  I simply reuse it in all of my web parts.

    It returns “DOMAIN\\USERNAME”

     

    private string GetUserAccount()
    {
        // Normally used with all web parts
        // By: Bill Daugherty II
        // Date Modified: 08/15/2010

        string impersonate = string.Empty;
        try
        {
            if (Request.QueryString["impersonate"].Length > 0) impersonate = Request.QueryString["impersonate"];
            if (Request.QueryString["i"].Length > 0) impersonate = Request.QueryString["i"];
        }
        catch
        {

        }
        string staffMember = string.Empty;

        // Gets the staff SAM account
        SPSite site = SPContext.Current.Site;

        SPServiceContext context = SPServiceContext.GetContext(site);

        // Uses the profile manager that was set up in Central Admin
        UserProfileManager profileManager = new UserProfileManager(context);

        if (impersonate.Length == 0)
        {
            // staffMember = SPContext.Current.Web.CurrentUser.LoginName.ToString();
            staffMember = HttpContext.Current.Request.ServerVariables["AUTH_USER"];
        }
        else
        {
            staffMember = impersonate;
        }

        return staffMember;

    }

    If you find that you use this also, please just add a comment.

    Bill

    Categories: SharePoint or Custom Development | 1 Comment

    Error setting up MySite


    When setting up a test site (one of our many) before we set up our production environment, I have come across this lovely error:

    An error has occurred in the claim providers configured from this site collection

    image

    When I went to create the MySite, I scrolled down a bit to the Read Permission Level configuration and found the users were not being found.

    image

    So when I click on the “Browse” icon, I get this wonderful message…

    image

    So, here is how I resolved the issue.  For what ever reason, my machine name was longer than the NetBIOS recommends (I have learned my lesions, don’t worry), and so the access mappings were not showing the full name of my machine (http://cssp01-testphase1:<port>/).  so I found out that this is simply why the error is occurring.

    image

     

    Tada!!! — No errors…

    image

    Categories: SharePoint or Custom Development | 6 Comments

    New CodePlex Web Part–PollWebPart (for the lack of a better name)


    So, this is how I decided to spend half of one of my days off.  Isn’t this sad?  I am addicted to development.

    I created a new voting web part that will allow users to vote once, and it will add a cookie to the users computer that will expire in 14 days, or until a new question comes around.

    It allows the user to use more than one list to store your question allowing for multiple concurrent polls at once.

    I first tried to download and install: http://pollingwebpart.codeplex.com/ however I could not get it to work with SharePoint 2010 even after I made the configuration changes.  I decided to create my own at this point.

    The project will be stored here: http://pollwebpart.codeplex.com.  I will upload it shortly.

    Here are the screenshots:

    Before Vote (supports up to 70 questions):

    image

    After Vote (Only shows the answered questions)

    image

    And here is the configuration…  You just enter the name of the list.  The list will be stored at the root site.

    image

    And here you can add items to the list.  The poll only shows the last item in the list. 

    image

    Categories: SharePoint or Custom Development | 9 Comments

    One of my other yet older blogs…


    This site is to act as a “code repository” for all of my source code that I use quite frequently.

    http://helperclass.com/

    Categories: SharePoint or Custom Development | Leave a comment

    Another great SP2010 reference…


    Here is a great reference from Microsoft regarding some of the SharePoint development tools:

    http://www.microsoft.com/downloads/details.aspx?familyid=C010FC68-B47F-4DB6-B8A8-AD4BA33A35C5&displaylang=en#filelist

    Categories: SharePoint or Custom Development | Leave a comment

    Configuration within SharePoint 2010 Web Parts


    When building SharePoint 2010 web parts, I have stumbled across the fact that there are really no easy ways to add a configuration file such as a web.config or an app.config.  So I decided to add a new project to my solution that I will eventually detach.  I expect it to build as a .DLL file and I can package it up with all of my solutions.  It will contain my connection string (with no passwords of course), also URL’s etc…

    I hope to find a better way of doing this, but for now I think this is really the way to go.  You can eventually swap out .DLL’s for use when testing, or switching environments.

    image

    Additionally, here is another way.  You can add the configuration to the root SharePoint site’s web.config file.  Reference this link for further instructions.

    If you come up with any better ways, I would like to hear about them.  For now, this is the safest way and most secure way.

    Categories: SharePoint or Custom Development | Leave a comment

    SilverLight WCF Web Service


    When using SilverLight 4.0 along with WCF, many are often trying to figure out why you are getting an error as such:

    An error occurred while trying to make a request to URI ‘http://localhost:8732/Design_Time_Addresses/MyService/Service1/'</a&gt;. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

    Well, for me, I got that error, but I was able to resolve it rather quickly.

    If you are like me, you will create your solution including a Web Service Layer (WCF), a Data Access Layer, Presentation Layer (SilverLight), and even more layers…

    …To put it simple, you can’t call your WCF Service unless it is deployed to an IIS Server because you must have a "Cross Domain Policy” in place.  And to add a cross domain policy you must add a file to your IIS Root path.

    So in short, as far as I can tell, you can’t debug your WCF service and your SilverLight application very well.  So this is where writing a bunch of unit tests will come in very well with your web service.

    I hope that I have explained the problem and the solution well enough above, below I will take you trough a small walk through below so you can see how I was able to accomplish the task as described above.

    Create a whole new solution in Visual Studio 2010.  Select SilverLight, SilverLight Application, and provide a name. Then select OK.

    image 

    The next part is up to you, we simply have no need to have a separate host for the SilverLight application.  But if you would like one created, you are more than welcome to at this point.  For my demo, I will not, I will deselect it, ensure I have SilverLight 4 selected, then click OK.

    image

    Add a new project to your solution.

    image

    Select WCF, and WCF Service Library, I called my project MyService, select OK

    image

    Rename your IService1 to something else by refactoring it.  You can do so with F2, or you can do a Control+H (I usually end up going this route)

    image

    If you did the F2 route (The refactoring route), you can select the new name, add search in comments, and click OK.

    image

    Check out your changes, then click Apply

    image

    Create your first Operation Contract as shown below…

    image

    Be sure to change your web service and interface file names.

    image

    Repeat the refactoring for the service application as well…

    image

    image

    image

     

    image

    Important Step: Be sure to change wsHttpBinding to basicHttpBinding in your app.config file.  This step is 100% required because SilverLight does not allow any other type of binding.

    image

    image

    image

    Next add a few controls as shown below to your WCF application

    image

    Double click your Call Service button to access the code behind

    image

    Add the following code…

    image

     Important Step: This step is the step that requires your WCF application to be hosted when building your SilverLight application.

    Create a directory in your wwwroot folder as I did below…

    C:\INETPUB\WWWROOT\wcfhost

    image

    In the WCFHOST directory create two new XML files as shown below…

    clientaccesspolicy.xml

    <?xml version="1.0" encoding="utf-8" ?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from http-request-headers="*">
            <domain uri="*"/>
          </allow-from>
          <grant-to> 
            <resource path="/" include-subpaths="true"/>
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>

    crossdomain.xml

    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"</a&gt;
    <cross-domain-policy>
      <allow-http-request-headers-from domain="*" headers="*"/>
    </cross-domain-policy>

     

    In IIS create a new web site calling it wcfhost as shown below…  I did this so that I can use port 88 as SharePoint happens to be installed on my 80 port.

    image

    You will see the new site as shown below…

    image

    Now its time to deploy your new web service…  Right click on MyService and click Publish…

    image

    Select your new web service site, then click publish.

    image

    Back in IIS, select your new web site and then refresh

    image

    Right click on your new MyService then select “Convert to Application”, this will enable it to run as an application

    image

    Be sure the application pool for the wcfhost site is actually .NET Framework 4.0.  This by default is 2.0, and it will not work.

    image

    Now test your WCF web service application…

    image

    Now right click on Service References in your SilverLight application, select Add Service Reference…

    image

    Select your new service location URL, then click GO to select your service, enter a namespace as shown below, then click OK

    image

    Hit F5 to run the SilverLight application, once you do this, you will be presented with this wonderful dialog.  Well, the web service is not hosted within the project, but it is now hosted, so even though the message box below does indicate it will not work, it will…  …Click Yes…

    image

    Enter your name, then click Call Service, cross your fingers…

    image

    And hopefully you will be presented with a dialog box as you indicated with the code above to show when it gets a string from the web service.

    image

    I hope this posting helped if you found it from your favorite search engine. 

    Categories: SilverLight, WCF | 5 Comments

    Deploying a WSP solution to SharePoint 2010


    To Deploy a WSP solution to SharePoint 2010 follow the simple steps below:

     

    Set up your path in your environmental table…

    SET PATH=%PATH%;C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN

    Locate Your DEBUG or RELEASE folder

    CD\DEPLOY

    Add your solution

    stsadm -o addsolution -filename YESPrep_Redirection.wsp

    Deploy your solution

    stsadm -o deploysolution -name YESPrep_Redirection.wsp -url http://nav-test.yesprep.local -allowgacdeployment -immediate

    pause

    ——————

     

    To Remove it before deploying another solution follow the steps below:

     

    Set up your path in your environmental table…

    SET PATH=%PATH%;C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN

    Locate Your DEBUG or RELEASE folder

    CD\DEPLOY

    Remove your solution

    stsadm -o retractsolution -name YESPrep_Redirection.wsp -URL http://cssp02-staging -immediate

    Remove your solution

    stsadm -o deletesolution -name YESPrep_Redirection.wsp

     

     

    Lastly make sure that you add the web part into the gallery (upload the *.webpart file)

    Categories: SharePoint or Custom Development | Leave a comment

    YES Prep’s 2010 Migration’s Status


    All,

    I just wanted to let the viewers of this blog know that our migration to SharePoint 2010’s second of three milestones have become a huge success.  I was able to implement MySite and it has become a huge success.  I will keep notes on here to see how the progress goes.

     

    Bill.

    Categories: SharePoint or Custom Development | Leave a comment

    Read Only Site


    After SharePoint 2007 SP2 it is easy to make a SharePoint site Read Only.

     

    Simple go to the Content Database that you want to make read only, and right click it, go to Properties…

    image

    Under Options, select True for the Database Read Only attribute…

    image

    Select Yes…

    image

    Your Content DB is now "Read Only"

    image 

    Here are before and after pictures of SharePoint, in my case it was our "MySite"

    Before…

    image

    After…

    image

    Categories: SharePoint or Custom Development | Leave a comment

    Great SharePoint 2010 MySite Promotional Material


    Here is some information from Microsoft:

    http://office2010.microsoft.com/en-us/sharepoint-server-help/basic-tasks-in-sharepoint-server-2010-HA101839175.aspx?origin=HA010371435

    I am going to re-use it in our organization to help promote the new MySites.

    image

    Categories: SharePoint or Custom Development | Leave a comment

    Moving Just the MySite from SharePoint 2007 to 2010


    As part of our migration plan, I would like to move just our MySite first.

    By doing this first, this will allow users to still reach their MySite as the rest of the intranet is down for several hours or days.

    In addition we have been really promoting our MySite’s, so we don’t want our users to be with out their shared and private data including documents while we are in this migration transition.

    We will also move our a record of “navigation.yesprep.local” to temporary intranet site to show the status of the upgrade.  It will also provide a link to their MySite.

    I wanted to be able to do this days/weeks before we do the final full migration.

    I have fully configured MySite in SharePoint 2010 with everything it needs to be fully functional.

     

    In our test SP 2007 environment I decided to test and make sure we can make the default mysite in 07 point to 2010.  And with much doubt from other SharePoint guru’s, it worked!

    Here is what I did to make it work.

    In the Shared Services in Central Administration, i went to My Site Settings…

    image

     

    I pointed the Personal Site Provider to my staging/test My Site, I also added the dynamically created site based on my settings in my SharePoint 2010 environment…

    image 

     

    IMPORTANT: Be sure that you select “Enable My Site to support global deployments,” otherwise this simply will not work, and you will get an error message saying that this didn’t work and you won’t have any indication as to what didn’t work…

    image

     

    To test it, go to the SharePoint 2010’s home page, and click “My Site”

    image

     

    Your new MySite should now point to SharePoint 2010!!!

    image

    Categories: SharePoint or Custom Development | Leave a comment

    SharePoint Upgrade Checklist


    We are getting close to that point where we will turn down the old SharePoint site and bring up the new.

    I found this from Microsoft: http://technet.microsoft.com/en-us/library/ff607537.aspx.  It is a checklist to go over what is needed and required to upgrade.

     

    Pre-upgrade steps for a database attach upgrade

    Prepare for upgrade

    [ ] Run the pre-upgrade checker

    [ ] Create an inventory of server-side customizations in the environment

    [ ] Clean up your environment

    Prepare the new environment

    [ ] Install and configure SharePoint Foundation 2010 and any language packs

    [ ] Configure general farm settings

    [ ] Create and configure Web applications

    [ ] Reapply server-side customizations

    [ ] Verify the new environment

    [ ] Run the pre-upgrade checker

    [ ] Set the previous version databases to be read-only (database attach with read-only databases)

    [ ] Back up databases

    [ ] Detach the previous version databases (standard database attach)

    [ ] Restore a backup copy of the database (database attach with read-only databases)

    [ ] Verify custom components

    [ ] Verify permissions

    [ ] Attach a content database to a Web application

    [ ] Verify upgrade for the first database

    [ ] Attach remaining databases

    [ ] Monitor upgrade progress

    [ ] Verify upgrade for the remaining database

     

    Post upgrade steps for database attach upgrade 

    [ ] Verify upgrade and review upgraded sites

    Additional Steps I like to add…

    [ ] Add My Site

    [ ] Update Old/Missing Web Parts

    Categories: SharePoint or Custom Development | Leave a comment

    Using Performance Point Viewer to render SSRS (Reporting Server) Reports


    When adding SSRS Reports to SharePoint 2010 using the new Performance Point Services Report Viewer Web Part, do the following…

    Under Site Actions, select More Options…

    image

     

    Select Performance Point Content Lists

    image

     

    Select “Add new item”…

    image

    That will load up a “Click Once” application that will show Performance Point Dashboard Designer…

     

    Click the Create Tab…

    image

     

    Type in the Server Name, then click Browse….

    image

     

    Select the report that you have selected…

    image 

     

    Select Preview…

    image

     

    Select the Properties tab, then give your report a name by entering the name in the name field…

    image

    (I did not fill anything else out)

    Click the Save in the toolbar…

    image

     

    Refresh your browser, and you should see your report in this list…

    image

     

    Go to the page where you wish to add your report, then click Edit…

    image 

     

    This is optional, but i wanted to switch the column to a single column…

    image

     

    Add a new web part, select Performance Point, Performance Point Report, then click Add…

    image

    Click “Click here to open the toll pane.”

    image

    Click on the List icon…

    image

    Select the report from the list you want to add, click OK…

    image

    And you should have the report displayed that you would like to see….

    image

    Categories: SharePoint or Custom Development | Leave a comment

    Upgrading a MySite from 2007 to 2010


    Okay, so I just wanted to say that I upgraded our My Site into our staging environment to test and to see how it will work.  I will say it worked out well.

    image

    This worked out well.  I just combined the two items that I blogged about before:

    1. Set up your My Site as a different application
    2. Upgrading your 2007 Data Content DB to 2010

    Except this time I did not preserve the theme.

    stsadm -o addcontentdb -url http://my-test.yesprep.local -databasename SharepointMySitesContent -databaseserver cssql03-staging -preserveolduserexperience false

    image

     

    Worked great!

    Categories: SharePoint or Custom Development | Leave a comment

    Changing the look of your Global Navigation (Top Menu Bar)


    Changing the look of your top menu navigation bar is rather simple.  I will demonstrate here how to accomplish this.

    Here is the example below…

    clip_image002

     

    In SharePoint Designer 2010, and your site open, go to All Files, then Style Library

    clip_image004

     

    From File, create a new CSS file calling it Style…

    clip_image006

     

    Open the file style.css that you just created…

    clip_image008

     

    Apply the following:

     

    /* Non text menu */

    .s4-tn{

    padding:0px;

    margin:0px;

    background-color:#B0C5FF;

    color:navy;

    }

     

     

    .s4-tn ul.static{

    white-space:nowrap;

    }

     

     

    /* Top Menu */

    .s4-tn li.static > .menu-item{

    /* [ReplaceColor(themeColor:"Dark2")] */ color:#3b4f65;

    white-space:nowrap;

    border:1px solid transparent;

    padding:4px 10px;

    display:inline-block;

    height:15px;

    vertical-align:middle;

    background-color:#B0C5FF;

    color:navy;

    }

     

    /* Border around the menu sub items */

    .s4-tn ul.dynamic{

    /* [ReplaceColor(themeColor:"Light2")] */ background-color:white;

    /* [ReplaceColor(themeColor:"Dark2-Lighter")] */ border:1px solid #003399;

    }

     

    /* Actual Menu Item */

    .s4-tn li.dynamic > .menu-item{

    display:block;

    padding:4px 10px;

    white-space:nowrap;

    font-weight:normal;

    background-color:#B0C5FF;

    width:200px;

    color:navy;

    }

     

    /* Menu Item Hover Over */

    .s4-tn li.dynamic > a:hover{

    font-weight:normal;

    color:navy;

    /* [ReplaceColor(themeColor:"Light2-Lighter")] */ background-color:#D9D9D9;

    }

     

    /* Hover over top menu */

    .s4-tn li.static > a:hover

    {

    /* [ReplaceColor(themeColor:"Accent1")] */ color:#44aff6;

    text-decoration:underline;

    color:navy;

     

    }

     

    /* hide arrows for top level items with flyouts */

    .menu-horizontal a.dynamic-children span.additional-background,

    .menu-horizontal span.dynamic-children span.additional-background{

        padding-right:0px;

        background-image:none;

    }

     

     

     

    Within your active master page, make the following change: Remove “sitename”

                    <SharePoint:CssRegistration name="/Style Library/sitename/style.css"  After="corev4.css" runat="server"/>

    To

                    <SharePoint:CssRegistration name="/Style Library/style.css"  After="corev4.css" runat="server"/>

     

     

    clip_image010

    Categories: SharePoint or Custom Development | 7 Comments

    Web Part Headers


    The web part headers out of the box are very boring and add a lot of white space.

    I wanted to show you how to fix that.  I created a gradient image in Adobe Photoshop (2 minute project):

    Here is the image in case you wanted it: clip_image002

    I saved the file to a location that everyone will be able to access at least in read only mode.

    Then I wanted to apply it to the headers for all of my web parts (if they are something other than a hidden web part):

    .ms-WPHeader{

    /* [ReplaceColor(themeColor:"Light1")] */ /* background-color:#FFFFFF; */

    background:url("/_catalogs/masterpage/en-us/Preview Images/YESLogo/TitleBarBack.png"); /* ***Added: 06-14-2010 *** */

    }

    .ms-WPHeader .ms-wpTdSpace{

    width:5px;

    border-bottom:1px solid transparent;

    background:url("/_catalogs/masterpage/en-us/Preview Images/YESLogo/TitleBarBack.png"); /* ***Added: 06-14-2010 *** */

    }

    .ms-WPHeaderTdMenu{

    width:20px;  /* ***Changed: 06-14-2010 *** Removed old value from 21px; to 20px; */

    cursor:pointer;

    word-wrap:normal;

    white-space:nowrap;

    border:0px solid transparent;

    }

    Here is the end result

    clip_image004

    Categories: SharePoint or Custom Development | 1 Comment

    Troubleshooting SharePoint Errors…


    For those of you who are getting errors in SharePoint and can’t figure out what is going on and how to troubleshoot them? 

    To the SharePoint Administrator and Developer they are pretty worthless errors.  So I wanted to show you how to further troubleshoot them.

    You will see the following screens as such:

    clip_image002

    Or the message might show up like this:

    clip_image004

    You have two options that can be used in combination if you wanted.

    ULS Viewer

    1. Download the ULS Viewer from Microsoft Code

    2. Open the ULS Viewer application

    3. Go to File then Open From select ULS
    clip_image006

    4. Select the file that you wish to open, in my case I wanted a UNC Path folder
    clip_image008

    5. From the toolbar, unselect all of the warning types except for Critical/Error
    clip_image010

    6. Have the user duplicate the error once again, make sure you get the new GUID from them

    7. Right click on the GUID once you found it in the list below and select “Filter By This Item”
    clip_image012

    8. Select Correlation, and ensure the GUID is entered in there:
    clip_image014

    9. Now you should have enough to work with.  Ensure that you are not looking at the message, but that you are looking at the stack trace
    clip_image016

    If the error was recent enough, you can go back in time and look at the specific log file by going to File Open From >> File

    clip_image018

    Open the file when the error occurred

    clip_image020

    Select Filter from the toolbar

    clip_image022

    Type in the first part of the GUID select OK

    clip_image024

    And you should have details about that log.

    clip_image026

    Another great feature is the Correlation Tree Button.  This allows you to view the unique Names or Correlation ID’s

    clip_image028

    Alternately you can go into the web configuration file C:\\INETPUB\\WWWROOT\WSS\\VIRTUAL DIRECTORIES\\80\\web.config and find the string:

    <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

    Modify it to show:

    <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

    Also find the string:

                        <customErrors mode="Off" />

    Modify it to show:

                        <customErrors mode="On" />

    The last part is okay to use, however it is not as elegant.  I will use it in our Staging/Testing/Development environment to save time from looking at the ULS Logs (unless I have the logger running), however I will not enable it in the production.

    Categories: SharePoint or Custom Development | Leave a comment

    Upgrading SharePoint 2007 to 2010


    In this entry, I wanted to show you how we decided to upgrade our SharePoint environment.  As you can tell this is something that you should carefully plan out. 

    I would like to point out a few links to read up on while planning out your migration:

    http://technet.microsoft.com/en-us/sharepoint/ee517214.aspx

    http://msdn.microsoft.com/en-us/sharepoint/ee514557.aspx

    http://blogs.technet.com/b/tothesharepoint/archive/2009/11/10/3292072.aspx

    We decided to take a hybrid approach that is not really even listed in any of the above links:

    1. Make a backup of all the content databases in production SharePoint’s SQL Server(s)

    2. We create a new virtual (Hyper V) machine of SQL Server 2008 R2 (our server name so that you can follow below is called “CSSQL03-STAGING”)

    3. We create a new virtual (Hyper V) machine of SharePoint 2010 Enterprise pointing it to the newly created SQL Server (our server is called “CSSP02-STAGING”)

    4. We restored the content databases from step 1 into the newly created server

    5. Removed the new default content database

    6. Add the recently restored content databases in SharePoint

    7. Make a backup of the content databases and restore them into a production environment once you are ready.
    (All of this will have to be done while your site is in a read only mode)

    I will assume you will get through the first portion of this (if not, I will blog further about that).

    So, when I went to this step, I removed the old content database, then went to add the new one….

    clip_image002

    clip_image004

    clip_image006

    clip_image008

    However when I went to add the new one, I go this message:

    This content database requires upgrade and could not be attached in this operation. Use either the [stsadm -o addcontentdb] command or [Mount-SPContentDatabase] cmdlet instead.

    There was very little (as in no) documentation anywhere showing how to resolve this with the command that it gave me.  So I figured I would just wing it…

    Under Command Prompt (with elevated permission) navigate to the SharePoint hive directory…

    cd "\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN

    Enter the following command in (changing your database name and new SharePoint website’s URL to the new one…

    stsadm -o addcontentdb -url http://cssp02-staging -databasename sharepoint.navigation.content -databaseserver cssql03-staging -preserveolduserexperience true

    clip_image009

    In my case, I had to add a few more content databases, so I just re-ran the same command but changed the content databases each time for all the different content databases.

    Test your site, and it should work! 

    (old site)

    clip_image011

    (new site)

    clip_image013

    Next steps are you will have to go through and remove all absolute URL’s and replace them with relative URL’s.

    You will have to also create y our MySite as I show you how in another blog, then perform the same action with that.  I have not done this part yet however, but if I do find any differences there, I will blog about that as it happens.

    Now when users are able to start moving their site to the new look, all they have to do will be to go to the SharePoint site and under Site Actions, point to Visual Upgrade

    clip_image015

    WARNING: This may cause issues that are difficult to recover from, so be sure you can roll back.  In my case I use Hyper-V and snapshots a lot for this scenario mostly so that I can apply the previous snapshot instance.  Also use Preview just in case first

    clip_image017

    Categories: SharePoint or Custom Development | 1 Comment

    Making a copy of SharePoint 2007 for Test


    When creating an environment for SharePoint 2007 for testing I had found a lot of messy documentation out there.  The real point is that I was unable to find great and through documentation.

     

    Here is my situation.

    ·         I have about 3 sites in SharePoint 2007 that I require to be moved into a testing/staging environment.

     

     

    Here are the steps that I took.

     

    First, backup all of

     

    In the SQL Server (my server is called cssql02-staging), restore all of the content databases.

     

    Right click on Database in SSMS, click Restore Database

    clip_image002

     

    Enter the name of the database name…

    clip_image004

     

    Select From Device, then click the ellipse button.

    clip_image006

     

    Click Add…

    clip_image008

     

    Locate the database you backed up, and click OK

    clip_image010

     

    Select OK

    clip_image012

     

    Select the database backup, and click OK

    clip_image014

     

    Click OK after your database was restored

    clip_image016

     

    In the production Central Administration, select Application Management >> Content Databases

    clip_image018

     

    Take note of the web applications you have, and the different database names (aka content db’s)

    clip_image020

     

    Back in your new staging/test server, and under Applicaton Management, select Create or Extend Web Application

    clip_image022

     

    Choose Create a new Web Application

    clip_image024

     

    Enter the name of the web site as you would have seen it in the production server, but don’t enter a host header unless you created an a-record already in DNS.

    clip_image026

     

    Enter your application pool information, use your service account.

    clip_image028

     

    Select to restart IIS

    clip_image030

     

    Select OK

    clip_image032

    You should see the Application Created screen, don’t create a site collection at this point.

    clip_image034

     

    Under Central Administration, select Application Management, and Content Databases

    clip_image018

     

    Select the new web application you created, then select WSS_Content

    clip_image036

     

    Next, you will want to take this database off line, and remove the content DB, select OK after you made these changes…

    clip_image038

     

    Now that you do not have any content databases, you can select to Add a content database

    clip_image040

    Recall and Take note of what you had in your production server…

    clip_image042

     

    Also, it’s a good idea to have SSMS open so you can ensure the names of the databases are going to be correct for the next step.

    clip_image044

     

    When you add the content database, you can reuse an existing database (this is the trick).  Enter the first database you restored that is in the application list above…

    clip_image046

     

    Select OK

    clip_image032

     

    Once you add all of your databases to your application, then you should be all set.  You will be able to test your site.

    clip_image048

     

    You are done!

    Categories: SharePoint or Custom Development | 1 Comment

    WCF Allowing more than the default 10 connections.


    Again, not really a SharePoint topic, however more of a developer topic.

     

    When building WCF web services, you will want to be sure that you allow enough concurrent connections.  The default concurrent connections to your WCF web service is 10.

     

    When you think about it, you may have 3 or 4 calls when the client application loads, and another 3 or 4 calls when the program is interacting with the web service.  This becomes an issue quite quickly.  The GC’s in the client application may not release the web service in time for the next calls, and more importantly the web service is a service, so the whole idea is to have many clients concurrently call the web service.

     

    Below, I replaced my application name from “CMS” to “<appname>”, so be sure to replace that, but this will go in the <configuration> section of your web.config file.  Everything highlighted in yellow is items you may want to just swap your existing values for.   Once this is done you will want to perform an IISRESET as sometimes just changing the web.config may not be enough.  (because existing connections)

     

      <system.serviceModel>

        <bindings>

          <wsHttpBinding>

            <binding name="NewBinding0" closeTimeout="23:59:00" openTimeout="23:59:00"

                receiveTimeout="23:59:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647">

              <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />

              <reliableSession inactivityTimeout="23:59:00" />

            </binding>

          </wsHttpBinding>

        </bindings>

        <services>

          <service behaviorConfiguration="<appname>.Service.ServiceBehavior"

            name="<appname>.Service.Service">

            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding0"

              contract="<appname>.Service.IService">

              <identity>

                <dns value="localhost" />

              </identity>

            </endpoint>

            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

          </service>

        </services>

        <behaviors>

          <serviceBehaviors>

            <behavior name="CMS.Service.ServiceBehavior">

              <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000" maxConcurrentInstances="10000"/>

              <serviceMetadata httpGetEnabled="true" />

              <serviceDebug includeExceptionDetailInFaults="true" />

            </behavior>

          </serviceBehaviors>

        </behaviors>

      </system.serviceModel>

    Categories: SharePoint or Custom Development | Leave a comment

    Expanding the scrollbar past the ribbon.


    As you can see from the first image below, the out of the box scrolling functionality is somewhat limited, it keeps the ribbon (and possible titles above the scroll bar).  My organization requires that I expand this scroll bar to the full height of the screen because all of our staff for the most part spends their time looking at SharePoint with lower to middle resolution laptops screens.  So the bottom line is real estate is really important, and we don’t need the ribbon to be static.

    clip_image002

    In the v4 master page (or any v4 master page including any of the starter pages you may have downloaded) do the following:

    1. Remove the tag “_fV4UI” variable all together from the javascript in the header….  In this case you can remove the whole script if that is all that is in there…
    clip_image004

    2. Remove the scroll attribute in the body tag…
    clip_image006

    3. Change the name of the s4-workspace, in my case, I just added “-custom” to the ID.
    clip_image008

    4. Locate the body CSS rule (attribute)…    …(mine was located in the v4.master as I got my master page from the CodePlex site.

    a. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV4.CSS

    b. Your Master Page (i.e, v4.master)

    5. Lastly change the name of the body by removing the width, height, and overflow attributes from the “body” CSS rule from the above location (either your corev4.css file or in the master page)

    clip_image010

    Categories: SharePoint or Custom Development | 4 Comments

    Removing the Quick Launch Bar in SharePoint 2010’s Master Page


    Removing the left navigation bar (the Quick Launch) all together in SharePoint 2010.

    clip_image002

    In the master page (or even in a web part), add the following to the header (or within the HTML view of the content editor web part)

                    <style type="text/css">

                                   /* removes the left quick launch */

                                   #s4-leftpanel{

                                                    display:none

                                                    }

                                                    .s4-ca{

                                                    margin-left:0px

                                                    }

                    </style>

    And villa… You should be all set..

    clip_image004

    Categories: SharePoint or Custom Development | 6 Comments

    Setting up the User Profile Synchronization Services


    I couldn’t have said it any better than they did in this article…

    http://www.sharepointdevwiki.com/display/spadmin2010/15+-+Configure+User+Profile+Synchronization+Service

    Go to Central Admin, and Central Administration, (It is recommended to do this in the server that you installed SharePoint, however I was unable to when doing so, so I went to my local machine.

    Start the service User Profile Services

    The rest I got from the link from above

    clip_image002
    Click "start" on "User Profile Synchronization Service"
    clip_image004
    Click "OK"
    clip_image006
    clip_image008
    Click on "monitoring" on left hand side and then click on "Review Job Definitions"
    clip_image010
    Click on "Running Jobs" on left hand side
    clip_image012
    You should now see ProfileSynchronizationSetupJob running
    clip_image014
    Keep refreshing until it disappears and then you’ll notice it’ll disappear. Click on "Job History" on left hand side, you should see the job with status of Successful.
    clip_image016
    In Windows Services you should now see Forefront Services both started and running under your administrator account.
    clip_image018
    Click on "Application Management" then click on "Manage service applications"
    clip_image020
    Scroll down and click on "User Profile Service Application"
    clip_image022
    Click on "Configure Synchronization Connections"
    clip_image024
    NOTE: you may see the below error, if you do simply do an IISRESET
    clip_image026
    Click Create New Connection
    clip_image028
    Fill in details
    clip_image030
    Click "Populate Containers" button then expand tree and select "Users" OU tree node and then click "OK".
    NOTE: Clicking "Select All" does not work in this build!
    clip_image032
    You should now see a connection in this list.
    NOTE: if you get to next screen and nothing shows, please ensure both Forefront Windows Services are started.
    clip_image034
    Go back to "User Profile Service Application" page from "Manage Service Applications"
    clip_image036
    Click "Start Profile Synchronization"
    clip_image038
    Select "Start Full Synchronization" then click "OK".
    clip_image040
    NOTE: this will take a few minutes as a job is scheduled to do this.
    clip_image042
    Now if you click "Manage User Profiles" you’ll see the User Profiles coming through
    clip_image044
    In Beta 2 it is normal to see these warning errors in the Event Log.
    clip_image046
    Also note that you cannot edit the connections because of a JavaScript error.
    clip_image048
    For more information on the User Profile imports go to:
    C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\UIShell\ and run MSIISClient.exe
    clip_image050
    clip_image052
    If you get this error:
    "Cannot navigate to the requested page while User Profile Synchronization is running. Please wait for the current Sychronization run to finish."
    You will need to restart the machine (you can most likely just restart the services too)

    Categories: SharePoint or Custom Development | 1 Comment

    Installing Hyper-V Tools on Windows 7 (Pro, Ent, Ult)


    Installing HyperV Tools on your Windows 7 is easy.  Simply download the RSAT (Remote Server Administration Tools) from Microsoft.  Once you have installed the MSI, you will then need to go to “Turn Windows features on or off” from the Add and Remove Programs screen.

    clip_image002

    Select Remote Server Administration Services

    clip_image004

    Under Role Administration Tools, select Hyper-V Tools

    clip_image006

    After this, you should be set up.  Go to Start, Administrative Tools, and select Hyper-V Manager.

    clip_image008

    Categories: SharePoint or Custom Development | 1 Comment

    Access Denied when browsing from server to SharePoint 2010


    In SharePoint (2007 or 2010) I had an issue where I can’t be RDP’ed in the machine and browse to the site.  While I was on a Microsoft Call talking with a tech regarding a ticket that I had opened on another topic, I mentioned this as an issue, and he said we could fix it right now, so here is what we did:

    Go to Start, type in REGEDIT and hit enter.

    Then go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA and create a new DWORD “DisableLoopBackCheck” set it to a decimal and set to 1.  This will allow you to brows to your own site.

    clip_image002

    Categories: SharePoint or Custom Development | Leave a comment

    Issue sending emails to a document library!


    I ran into an issue where I was sending emails to a document library, and though I had everything set up correctly, I was getting the following message:

    Delivery has failed to these recipients or groups:

    test@nav.yesprep.local
    The recipient e-mail system can’t process this message now. Please try resending the message later.

    clip_image001

    This was a very simple fix.  I added an A record to the site, and called it nav.yesprep.local pointing it to my server, however I didn’t add it as a binding in IIS as it seemed like everything else worked.  So I added it, and it worked ASAP:

    clip_image003

    clip_image005

    Categories: SharePoint or Custom Development | 1 Comment

    Configuration of Inbound Email


    Within the SharePoint’s Front End Web Server box, you must enable the SMTP Service along with the IIS Manager for 6.0 to manage and configure it…

    clip_image002

    Select SMTP Server

    clip_image004

    Select Add Required Role Services

    clip_image006

    Select Next

    clip_image008

    Select Next

    clip_image010

    Select Install

    clip_image012

    After Installation, select Finish

    clip_image014

    Still in the SP Server, and from Start, select Administrative Tools >> Internet Information Services (IIS) 6.0 Manager

    clip_image016

    From IIS6.0, select the name of the server, then right click on SMTP Virtual Server #1 choose Properties…

    clip_image018

    Select “All except the list below” then choose OK

    clip_image020

    In Exchange Server you must create a Send Connector, go to the following path in the Exchange Management Console:

    Organization Configuration >> Hub Transport >> Send Connectors >> New Send Connector

    clip_image022

    Enter a name of your SharePoint incoming mail connector, and select Internal

    clip_image024

    Click Add

    clip_image026

    Select the address…

    clip_image028

    Click Next

    clip_image030

    Click Add, then enter the IP Address

    clip_image032

    Click Next…

    clip_image034

    Ensure None is selected, then click Next…

    clip_image036

    Click Add, and add the name of the transport server…

    clip_image038

    Click New…

    clip_image040

    Click Finish…

    clip_image042

    In AD, add a new organizational unit

    clip_image044

    Call it something such as “SharePoint Contacts”

    clip_image046

    After creating it, select Delegate Control…

    clip_image048

    Click Next…

    clip_image050

    Click Add, and add the new service account

    clip_image052

    Select “Create a custom task to delegate…”  Click Next

    clip_image054

    Select “This folder, existing objects in this folder, and creation of new objects in this folder”, then choose Next…

    clip_image056

    Ensure the Create All Child Objects and Delete All Child Objects are selected, then choose Next…

    clip_image058

    Click Finish…

    clip_image060

    Under AD, select View, and choose Advanced Features…

    clip_image062

    Select Properties…

    clip_image064

    Click on Advanced….

    clip_image066

    Select the service account for your SharePoint Central Admin App Pool User, click on Edit..

    clip_image068

    Enable Delete Subtree…, choose OK

    clip_image070

    Perform an IISReset in the primary SharePoint System.

    In Central Admin, go to System Settings, then under E-Mail and Text Messages (SMS) select Configure Incoming  Email Settings

    clip_image072

    Enable “Receive Email”, and enter the name of your server.

    clip_image074

    Now, add an MX Record in your primary DNS Server:

    clip_image076

    Enter the name of your MX Record host, as well as the FQDN (the name of the machine)

    clip_image078

    Next, test it, and you should be okay.

    Categories: SharePoint or Custom Development | 1 Comment

    Configuration of Outbound Email


    In Central Admin, go to System Settings, then under E-Mail and Text Messages (SMS) select Configure Outgoing Email Settings

    clip_image002

    Enter your Outbound SMT Server and From and Reply To address, then choose OK

    clip_image004

    Now under your Exchange Server, open up your Exchange Management Console and choose Hub Transport under Server Configuration, and double click Anonymous…

    clip_image006

    Now select the Network Tab, and select Add…

    clip_image008

    Enter the IP Address of your SharePoint server.

    And then you should be finished!

    Categories: SharePoint or Custom Development | Leave a comment

    Setting up MySite as a different Application


    To correctly set up the “My Site” you should put it in a different application domain.  You will get the following message: Validate the My Site Host and Individual My Sites are on a dedicated Web application and separate URL Domain

    clip_image002

    clip_image004

    Here is how to go about doing this:

    Under Central Administration, select New to create a new site from the ribbon

    clip_image006

    Ensure that you have created an A record for “my” (or My Site)

    clip_image008

    Enter the following information as such:

    clip_image009

    You will get this message:

    clip_image011

    Now, create the site collection as a My Site Host

    clip_image013

    Ensure that you have Self Service Site Creation enabled

    clip_image015

    Click OK

    clip_image017

    You should be set!

    clip_image019

    The next step is to let SharePoint know that is where your default MySite is going to be located.

    In Central Administration point to: Manage Service Applications under Application Management.

    clip_image021

    Select User Profile Service Application

    clip_image023

    Select Setup My Sites in My Site Settings

    clip_image025

    One last bit of configuration that I am noticing is that I cannot add new “My Content”.  Here is how to fix that:

    Your personal site cannot be created because the managed path "personal" has not been created for this site. Contact your site administrator for more information.

    clip_image027

    Select your application, then choose Managed Paths in the ribbion

    clip_image029

    Type in “personal” in your path.

    clip_image031

    Select OK and you can test it now.

    Works for me now!

    clip_image033

    Categories: SharePoint or Custom Development | 11 Comments

    Adding a Sub Domain (A Record) to your site


    Often it is needed that you set up an A Record (or a sub domain) to your new SharePoint site, here is how you do it. 

    I am looking to add nav.yesprep.local to access our new intranet site.

    · I added the A Record in DNS and pointed it to the correct IP Address.

    · Next you need to configure the alternate access mappings.  From Central Administration, and under Application Management >> Web Applications >> Configure Alternate Access Mappings…
    clip_image001

    · Click Add Internal URLs
    clip_image003

    · Now select a site collection
    clip_image005

    · Select you’re A Record (sub-domain name)
    clip_image007

    · For the Zone, you want to make sure this says Intranet
    clip_image009

    After everything propagates you should be all set to go.

    clip_image011

    Categories: SharePoint or Custom Development | 4 Comments

    AdventureWorks Master Page… Yes, you have it!


    Over the last two weeks I have been trying to find the Adventure Works site theme… It was under my knows the whole time.  I found it, and here is how.

    clip_image002

    clip_image004

    Categories: SharePoint or Custom Development | 1 Comment

    Another great developers blog.


    Here is a great friend of mine’s blog: http://mstecharchitect.blogspot.com/

    I RSS his feeds every day, and I have learned a lot of LINQ, C#, and a lot of other development stuff.

    Please check it out!

    Categories: SharePoint or Custom Development | Leave a comment

    Removing projects from Team Foundation Server


    I am in the process of moving all of my projects from the old TFS2008 to the new TFS2010, and I am in need of removing the old projects so that none of my developers use them.

    To do this, first backup your TFS Database as you should have a maintenance plan for it anyway to backup, but be sure to double check for that.

    Next, run navigate to the IDE location in the Command Prompt:

    · x86 Systems – Enter: cd "Program Files\Microsoft Visual Studio 9.0\Common7\IDE"

    · x64 Systems – Enter: cd "Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE"

    · Type in: c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE>TFSDeleteProject.exe /server:[TFSServer] "[ProjectName]"
    For example: c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE>TFSDeleteProject.exe /server:cstfs1 "Business Intelligence"
    clip_image002

    · Next you will see this message:
    Warning: Deleting a team project is an irrecoverable operation. All version control, work item tracking and Team Foundation build data will be destroyed from the system. The only way to recover this data is by restoring a stored backup of the databases. Are you sure you want to delete the team project and all of its data (Y/N)?

    · Select Y if you are 100% sure you want to do this

    clip_image004

    Done!

    Categories: SharePoint or Custom Development | Leave a comment

    Moving a TFS 2008 Project to TFS 2010


    Okay, so it’s not directly related to SharePoint, but it is related to Team Foundation Server 2010.  I am in charge of our software development team, and we use to be on TFS 2008 Workgroup Edition limiting 5 users.  I had to remove myself and have a few folks share a user ID because a BI project we had (SSIS, SSRS, SSAS) was still on the 2008 TFS Server, and we have more than the 5 developers.  I eventually added myself back, and decided that it is time to move projects to the new TFS2010.

    I decided to move it all, however when I unbind, and rebind, I get the following message:

    The solution is in a directory mapped to team server http://<Original_TFS_server_name>:<port>.
    Continuing will close the existing team server Target_TFS_Server and open team server http://<Original_TFS_Server_name>:<port>/ Continue?

    clip_image002

    Okay, this is not cool!  Why would I like to re bind to the old server, and why doesn’t it give me the option to connect to the new server?

    Answer: Because VS 2008 is looking at the old Team Foundation Cache.  Here are the steps to solve this issue that will connect your old project to the new team foundation server:

    First with your Visual Studio project open, go to File, Source Control, and Change Source Control…
    clip_image004

    Next, unbind all of he projects…
    clip_image006

    Continued…
    clip_image008

    All of your projects inside of your solution should now be unbound.
    clip_image010

    Next, from the Tools Menu in Visual Studio 2008, select Connect To Team Foundation Server…
    clip_image012

    Select the new 2010 server
    clip_image014

    Close Visual Studio 2008.

    Next, navigate in Explorer to the following path:

    %userprofile%\AppData\Local\Microsoft\Team Foundation\2.0\Cache

    Create a new folder called OldCache (or what ever you would like)
    clip_image016

    Move all of the files and folders from %userprofile%\AppData\Local\Microsoft\Team Foundation\2.0\Cache to the new folder you just created.
    clip_image018

    Open Visual Studio, while you are now connected to the new Team Foundation Server, open the new solution.  From the File menu, select Source Control, then point to Add Solution to Source Control…
    clip_image020

    Walla, you can now connect to your 2010 projects, and add this solution to the new TFS Server.
    clip_image022

    clip_image024

    You can reference this link from Microsoft for more information:
    http://support.microsoft.com/kb/957110/en-us

    Categories: SharePoint or Custom Development | 2 Comments

    Connecting Visual Studio 2008 to TFS 2010


    Though unrelated to SharePoint 2010, I felt it needed to discuss my unique findings with TFS 2010 implementation with others.  With the new TFS 2010 out, and as robust and great as it is, you still have old projects that you still need to maintain in VS2008.  The problem is getting connected to TFS 2010 isn’t that easy because you now have a forward slash in your path.  I will show you what I did to connect my VS2008 environment to TFS 2010 (Binding existing projects is a different story and the next blog)

    Our Environment:

    We have two TFS servers:

    · CSTFS1 – Visual Studio Team Foundation Server 2008

    · CSTFS01 – Visual Studio Team Foundation Server 2010

    · CSDEV1 – Our Development Environment with Remote Desktop Services (Formally Terminal Services) running VS2008 (and soon 2010)

    We tried to connect just simply, however we got the following message:

    TF31002: Unable to connect to this Team Foundation Server: CSTFS01 Team Foundation Server URL: http://cstfs01:8080

    clip_image001

    To resolve this:

    · Close Visual Studio! (Any and all versions)

    · Ensure that you are running VS 2008 with Service Pack 1

    · Download http://www.microsoft.com/downloads/details.aspx?FamilyID=cf13ea45-d17b-4edc-8e6c-6c5b208ec54d&displaylang=en

    · You must specify the URL as such: http://cstfs01:8080/tfs (or http://[TFSServer]:8080/[VirtualDirectory]/[ProjectCollection])

    · Open regedit.exe and navigate to: [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers]

    o Add this string: “cstfs01″=http://cstfs01:8080/tfs (replacing your server names with your own)

    · Open Visual Studio 2008, and point to your new TFS Server, and select your projects.

    I created a text file (c:\add_tfs2010.reg) with the following text, and had all of my users execute it with administrative privliges:

    Windows Registry Editor Version 5.00

     

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers]

    “cstfs01″=”http://cstfs01:8080/tfs

    Categories: SharePoint or Custom Development | Leave a comment

    Configuration Failed when installing SP 2010 on Windows 7 (Failed Big time!)


    You can install SharePoint 2010 on your Windows 7 computer.

    In my attempt to install SharePoint 2010 on my laptop computer for development reasons, I ran into quite a few issues.  But I was determined.

    But guess what…  I was able to resolve it.

    clip_image002

    clip_image004

    The Problems!

    When installing SharePoint 2010 on Windows 7, even if you install all of its prerequisites that it says to install, you get one of these two errors:

    An exception of type System.IO.FileNotFoundException was thrown.  Additional exception information: Could not load file or assembly ‘Microsoft.IdentityModel, Version 3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.  The system cannot find the file specified.

    -OR-

    An exception oftype Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown. Additional exception information: Failed to call GetTypes on assembly Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Could not load file or assembly ‘System.Web.DataVisualition, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find thefile specified.

    -OR-

    Failed to create the configuration database.

    An exception of the type Microsoft.SharePoint.SPException was thrown.  Additional exception information: User cannot be found

    (See both possible solutions below)

    Below are the steps that I took to get these errors.

    Installed SQL Server 2008 R2,  Installed SharePoint 2010 (with its prerequisites first).

    Went to Start,  SharePoint 2010 Central Administraton

    clip_image006

    clip_image008

    Clicked Yes

    clip_image010

    Clicked Next

    clip_image012

    WARNING: you are installing on windows vista or windows 7, which are unsupported configurations intended for use on developer workstations only.  This configuration should not be used as a production environment, or host any user content.

    Clicked OK

    clip_image014

    Clicked Yes

    You might get one of the errors below:

    clip_image016

    An exception of type System.IO.FileNotFoundException was thrown.  Additional exception information: Could not load file or assembly ‘Microsoft.IdentityModel, Version 3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.  The system cannot find the file specified.

    Click Finish.

    The problem is that the Windows Identity Foundation pack was not installed.  This can be fixed here: http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&displaylang=en#filelist

    -OR-

    clip_image018

    An exception oftype Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown. Additional exception information: Failed to call GetTypes on assembly Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Could not load file or assembly ‘System.Web.DataVisualition, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find thefile specified.

    Click Finish.

    The problem is that the Chart Controls cannot be found, you can download them here: http://go.microsoft.com/fwlink/?LinkID=122517

    -OR-

    clip_image020

    Failed to create the configuration database.An exception of the type Microsoft.SharePoint.SPException was thrown.  Additional exception information: User cannot be found

    Alright, this one is rather funny.  You can get this message if you are working from home, not connected to the network via VPN.  That was my case.  The user just cannot be found that is part of the domain for creating the SQL Server connection.

    SUCCESS!!!

    clip_image002[1]

    That all worked for me, hope it works for you!

    If you have more errors, then you can follow this: http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx, however some of the links are broken.

    Categories: SharePoint or Custom Development | 180 Comments

    My Project!


    So, I have a project that I am working on, and I felt because there is always a lack of documentation out there for SharePoint (especially 2010) I felt that I should publish my own blog as I go. I will be posting all of my content here. I am moving our Intranet system from SharePoint 2007 to SharePoint 2010. We are starting fresh, I will be building a series of applications to move old content to our new site, however the site map will change a little bit, so there will be quite a few challenges.

    I will also be adding my own branding, so as I work on our intranet site, getting it all up and done, I hope to help you out with yours by posting my experiences.

    Categories: SharePoint or Custom Development | Leave a comment

    Welcome to MySPExp (Experience)


    Hello all,

    Welcome to one of my blogs talking about my SharePoint Experiences.  I am planning on posting all of my experience and tools in my SharePoint Development here.

    Categories: SharePoint or Custom Development | Leave a comment

    Centering the body of SharePoint 2010 in a fixed width


    Here is how to center the width of the body in SharePoint 2010, you use the nosetwidth class for the workspace.

    <div id=”s4-workspace” class=”s4-nosetwidth” style=”position:relative; width:1024px; margin-right:auto; margin-left:auto; background:white;”>

    clip_image002

    clip_image004

    Categories: SharePoint or Custom Development | 8 Comments

    Blog at WordPress.com.