Download - Share Point
Table of Contents Introduction Project Specification Overview Projects Tasks
- SP Admin- SP Development- SP Business Processes- SP Portals
Introduction This project is for a fictitious towing services company called ACME,
Inc.
The project will design and establish a SharePoint application to support the company’s towing providers.
Project Specification Overview ACME Inc. is a large towing services company.
On their intranet they would like the ability to share sales decks amongst their sales personnel where a sales person may modify a sales presentation based off existing content.
They would also like to establish a shared calendar on their intranet site that would integrate into Outlook.
They would like to establish an area to publish a monthly news letter. A newsletter should be readable by anyone in the organization; it’s contributed by authors and reviewed/published by editors.
Lastly ACME would like to establish a shared area for contacts. Establish a contacts list utilizing a custom list and utilizing the Microsoft Application template for contact management.
Project Goals Create an intranet solution based on SharePoint Server 2007. Branded with a unique design. Shared calendar with integration into Outlook. Shared are for contacts list utilizing Microsoft Application template for contact
management. Share sales decks amongst their sales people where a sales person may
customize a presentation based off of existing content. Monthly Newsletter CMS site implementing out of box workflow for approval
process A dashboard to display the total dollar amount of un-invoiced Purchase orders,
Total dollar amount of unpaid invoices, Total PO amount that have been submitted.
Extend the solution to the Internet with sub-site creation for each provider.
SP Admin Objectives Create a new Site Collection for Acme Inc. Solution Portal A Solution Site Template A Developer Knowledge Base Enable SharePoint features to provide additional functionality to a
site collection Content Deployment Configure SharePoint Services Configure user groups and permissions
SP Development Objectives Create custom metadata to track information about a solution Setup the development environment to create and deploy solutions to the farm Change the look and feel of the solution site Create a content query Web Part to view all Solution list items Create a custom Web Part to allow managers to create new SharePoint
solution sites Create a custom web part to view all Solution sites using SharePoint’s versions
of GridView and DataSource controls Create a Search Center Modify the Advanced Search page to search by SiteTemplate column. Use Search Web Parts to display helpful information on Solutions elsewhere in
the Solution Portal
SP Business Processes Objectives Create custom workflows using Visual Studio 2008 and SharePoint Designer
SP Portals Objective Create a form and list that managers can use to submit Change Management
requests for a solution. Manage portals using Document and Record Centers Control the layout of the portal using publishing features
Additional Project Content Created custom content including master pages, page layouts and custom
search Worked with the Business Data Catalog, used Excel Services and Forms
Services Worked with the Reporting Center, Information Management Policies and
Dashboard with KPIs
Acme Branding Feature
ACME Home Page
Purchase Orders List
ACME Purchase Order InfoPath Form Custom form features
• Required fields enforced• Document name based on Ref
Number + date + Last Name• States pulled from db• Venders info pulled from
Vender list• Charge field value calculated
from distance and Vender towing rate
Invoice Forms List
ACME Invoice InfoPath Form Acme Invoice Form
• Required fields enforced• Document name based on
Invoice Number + Invoice Date• Venders info pulled from
Vender list
Create Vender Webpart Create Vender Webpart
• Creates a new vender site using a custom site template
• Creates an entry in the Vender list including a hyperlink to the site
• Creates a table and controls through code behind
Create Vender Webpart private HtmlTable CreateFormTable() { HtmlTable table = new HtmlTable(); table.Width = "100%"; // width set on page through webpart
#region Site Name Row HtmlTableCell SiteNameCell = new HtmlTableCell(); Literal SitetNameLiteral = new Literal(); SitetNameLiteral.ID = "SitetNameLiteral"; SiteNameCell.Width = "30%"; SiteNameCell.Align = "right"; SitetNameLiteral.Text = "Site Name: "; SiteNameCell.Controls.Add(SitetNameLiteral);
HtmlTableCell SiteNameTextBoxCell = new HtmlTableCell(); SiteNameTextBoxCell.Controls.Add(SitetNameTextBox);
HtmlTableRow SitetNameRow = new HtmlTableRow(); SitetNameRow.Cells.Add(SiteNameCell); SitetNameRow.Cells.Add(SiteNameTextBoxCell); table.Rows.Add(SitetNameRow); #endregion
#region Vender Description row HtmlTableCell VenderDescriptionCell = new HtmlTableCell(); Literal VenderDescriptionLiteral = new Literal(); VenderDescriptionLiteral.ID = "SiteDescriptionLiteral"; VenderDescriptionLiteral.Text = "Descrtiption: ";
VenderDescriptionCell.Align = "right"; VenderDescriptionCell.Controls.Add(VenderDescriptionLiteral);
HtmlTableCell VenderDescriptionTextBoxCell = new HtmlTableCell();
VenderDescriptionTextBoxCell.Controls.Add(SiteDescriptionTextBox);
HtmlTableRow SiteDescriptionRow = new HtmlTableRow(); SiteDescriptionRow.Cells.Add(VenderDescriptionCell); SiteDescriptionRow.Cells.Add(VenderDescriptionTextBoxCell); table.Rows.Add(SiteDescriptionRow); #endregion
#region Url Row HtmlTableCell UrlCell = new HtmlTableCell(); Literal UrlLiteral = new Literal(); UrlLiteral.ID = "UrlLiteral"; UrlLiteral.Text = "Url: "; UrlCell.Align = "right"; UrlCell.Controls.Add(UrlLiteral);
HtmlTableCell UrlTextBoxCell = new HtmlTableCell();
UrlTextBoxCell.Controls.Add(UrlTextBox);
HtmlTableRow UrlRow = new HtmlTableRow(); UrlRow.Cells.Add(UrlCell);
Create Vender Webpart (continued) #region Rate Row HtmlTableCell RateCell = new HtmlTableCell(); Literal RateLiteral = new Literal(); RateLiteral.ID = "RateLiteral"; RateLiteral.Text = "Rate: "; RateCell.Align = "right"; RateCell.Controls.Add(RateLiteral);
HtmlTableCell RateTextBoxCell = new HtmlTableCell();
RateTextBoxCell.Controls.Add(RateTextBox);
HtmlTableRow RateRow = new HtmlTableRow(); RateRow.Cells.Add(RateCell); RateRow.Cells.Add(RateTextBoxCell); table.Rows.Add(RateRow); #endregion
#region Blank row HtmlTableCell BlankCell1 = new HtmlTableCell(); BlankCell1.ColSpan = 2; Literal BlankLiteral = new Literal(); BlankLiteral.ID = "BlankLiteral"; BlankLiteral.Text = " "; BlankCell1.Controls.Add(BlankLiteral);
HtmlTableRow BlankRow = new HtmlTableRow(); BlankRow.Cells.Add(BlankCell1);
table.Rows.Add(BlankRow); #endregion
#region Create Button HtmlTableCell BlankCell2 = new HtmlTableCell(); Literal BlankLiteral2 = new Literal(); BlankLiteral2.ID = "BlankLiteral2"; BlankLiteral2.Text = " "; BlankCell2.Controls.Add(BlankLiteral2);
HtmlTableCell CreateSiteButtonCell = new HtmlTableCell();
CreateSiteButtonCell.Controls.Add(CreateSiteButton);
HtmlTableRow CreateSiteButtonRow = new HtmlTableRow(); CreateSiteButtonRow.Cells.Add(BlankCell2); CreateSiteButtonRow.Cells.Add(CreateSiteButtonCell); table.Rows.Add(CreateSiteButtonRow); #endregion return table; }
Create Vender Webpart (continued) protected void CreateSiteButton_Click(object sender, EventArgs e) { //// find our controls so we can work with them TextBox SiteNameTextBox =
(TextBox)FindControl("SiteNameTextBox"); TextBox SiteDescriptionTextBox =
(TextBox)FindControl("SiteDescriptionTextBox"); TextBox UrlTextBox = (TextBox)FindControl("UrlTextBox"); DropDownList SiteTemplatesList =
(DropDownList)FindControl("SiteTemplatesListBox"); CheckBox AllowUniquePermissionsCB =
(CheckBox)FindControl("AllowUniquePermissionsCBBox"); Button CreateSiteButton =
(Button)FindControl("CreateSiteButton");
if (SiteNameTextBox.Text == "") return;
// finally add the new site
SPWeb web = SPContext.Current.Web;
SPSite site = SPContext.Current.Site;
SPSecurity.CatchAccessDeniedException = false;
///* runs with admin privileges */ //1033 is For English Locale
try { // see what permissions a user has, normally we would
check but we are running with // an elevated permission set
// turn this off to test code below
SPWeb webInUserContext = SPContext.Current.Web; SPSite SiteInUserContext = SPContext.Current.Site;
Guid webGuid = webInUserContext.ID; Guid siteGuid = SiteInUserContext.ID; SPWebTemplateCollection templates =
SiteInUserContext.GetCustomWebTemplates(1033); SPWebTemplate template =
templates["vendersitetemplate.stp"]; SPSecurity.RunWithElevatedPrivileges(delegate() { // get the site in impersonated context using (SPSite siteElevated = new SPSite(siteGuid)) { siteElevated.AllowUnsafeUpdates = true;
// get the web in the impersonated context SPWeb webElevated =
siteElevated.OpenWeb(webGuid);
Create Vender Webpart (continued)SPWebCollection spSiteCol = webElevated.Webs;
webElevated.AllowUnsafeUpdates = true;
SPWeb newWeb = spSiteCol.Add("SiteDirectory/" + UrlTextBox.Text, SiteNameTextBox.Text, SiteDescriptionTextBox.Text, ((System.UInt32)(SPContext.Current.RegionalSettings.LocaleId)), "vendersitetemplate.stp", false, false);
webElevated.Dispose(); }
});
SPList list = web.Lists["Vender List"];
SPFieldUrlValue url = new SPFieldUrlValue(); url.Description = UrlTextBox.Text; url.Url = SPContext.Current.Site + "/SiteDirectory/" +
UrlTextBox.Text; SPListItem item = list.Items.Add();
item["Title"] = SiteNameTextBox.Text; item["Vender Name"] = SiteNameTextBox.Text; item["Vender Site"] = "http://dell2003srv/SiteDirectory/" +
UrlTextBox.Text + ", " + UrlTextBox.Text;
item["Towing Rate"] = RateTextBox.Text; item["Vender Description"] =
SiteDescriptionTextBox.Text;
item.Update();
SiteCreationResult = "Success!";
}
catch (Exception ex) { SiteCreationResult = ex.Message; }
finally { SPSecurity.CatchAccessDeniedException = true; } }
Vender List
Purchase Order Workflow Simple Sequential Workflow Visual Studio 2008 workflow Copies the new PO to the PO list in
the vender site PO list when form is submitted
Workflow Code public Guid workflowId = default(System.Guid); public string errorMessage = string.Empty; public SPWorkflowActivationProperties workflowProperties = new
SPWorkflowActivationProperties();
private void codeCopyDocToLib_ExecuteCode(object sender, EventArgs e)
{ // Get the item the workflow is running on SPListItem item = workflowProperties.Item; string siteUrl = string.Empty;
try { //Get the field that contains the vender name. string name = item["Vender"].ToString(); // Set the name of the document library and site // where to copy the document to
SPSite sourceSite = workflowProperties.Site; SPWeb sourceWeb = sourceSite.OpenWeb(); string[] urlArray = null;
SPList list = sourceWeb.Lists["Vender List"]; for (int i = 0; i < list.Items.Count; i++) { SPListItem venderItem = list.Items[i]; if (venderItem["Vender Name"].ToString().Equals(name)) {
siteUrl = (String)venderItem["VenderRateURL"]; urlArray = siteUrl.Split(','); } } //string siteUrl = "http://vm187:100/solutions/Test"; string libName = "Purchase Orders"; if (siteUrl != null) {
siteUrl = urlArray[1]; // Open the site using (SPSite site = new SPSite(siteUrl)) { using (SPWeb web = site.OpenWeb()) { if (item.File != null) { // Copy the document to the library SPFolder library = web.Folders[libName]; library.Files.Add( item.Name, item.File.OpenBinary()); library.Update(); } } } } } catch (Exception ex) { errorMessage = ex.Message; }