SharePoint Requirements Analysis Guide

June 23, 2014

Source

http://www.sharepointgeoff.com/welcome-to-sharepointgeoff-home-of-stationcomputing/analysing-user-requirements-for-sharepoint/

Accessing Taxonomy Term Store with JSOM

June 23, 2014

This blog will show you how to access the Taxonomy Term Store, how to iterate through all the items. How to add a Group, TermSet and Term, and lastly how to delete them. The Taxonomy Term store can be accessed in a SharePoint App, with permission scope of Taxonomy.

To be able to use the JSOM API for Taxonomy you need to reference SP.Taxonomy.js found in _layouts/15/ the best way to reference this would be in the document ready.

Accessing Taxonomy Term Store with JSOM

 

 

 

Migrate SharePoint 2010 content with managed metadata challenges

June 23, 2014

Let us set up the site collation so we could demonstrate the issues and solution.

 

1. First, we will create a site collection with URLhttp://sbx08/sites/MMDDHW/SitePages/Home.aspx

2. Second, we set up the global managed term group named “QCGlobal” with one Term Set named Set1 with two terms. Then set up site collection local Term Set named “LocalMMS” with two terms. You could view both global and local term store setting for this site collection from the following screen shot

 

 

3. Third, we create a list named “MMD1” with one managed column “LocalMMD” linked to local term store and another managed column named “GlobalMMD” linked to global term store

4. Finally, add a new item and link the localMMD and GlobalMMD to local and global terms “Test1” and “Global1

 

 

At this time, you could edit the item and verify both terms are linked to global or local term stores. Both columns are editable.

 

 

 

Let’s migrate this site collection from this webapp to a different one with same MMS. I’m using site collection backup and restore method to demonstrate this. Here are the steps.

  •  Back up the existing site collection using powershell

Backup-SPSite -Identity http://sbx08/sites/MMDDHW -Path C:\MMDDHW.bck

  • Create a new site collection http://sbx08:20339/sites/MMDDHW in destination webapp using blank template
  • Restore the existing collection destination webapp using powershell

Restore-SPSite –Identity http://sbx08:20339/sites/MMDDHW  -Path C:\MMDDHW.bck  -Force 

 

Now if you browse the site, you will see identical site collection comparing to source site collection.

 

 

 

However, when you try to edit the item with managed metadata column, the global column is editable but the local term is grayed out not editable. The reason global term is editable because we migrated the site collection to the webpp with same MMS. IF you migrate to a webapp with different MMS, the global term will also not editable as shown in the following screen shot.

 

 

The question is how to fix the local terms. I follow the same procedure and script published by SergeyZelenov even the script is not meant for this purpose. Here are the procedures to fix local terms.

  • Open Powershell ISE
  • Open RestoreSPSiteLocalTermSet.ps1 powesshell
  • Run Selection (F8) (Do not click Run!)
  • Enter the destination site collection URL http://sbx08:20339/sites/MMDDHWand click OK
  • You will see the following message

PS C:\Users\harrycx> Restore-SPSiteLocalTermSetAccess

Site collection’s access to term store group ‘Site Collection – sbx08-sites-MMDDHW’ restored successfully

 

 

 

Now, the issue resolved and both local and global columns are editable again!!!

There are some other ways you could use to migrate site collections from one webapp to another webapp. Here is the list of some of the ways with my suggestions.

  • Export and import (Do not use and prefer backup and restore as we discussed before)
  • Content DB detach and attach (Use it when site collection is larger than 15G)
  • Metalogix migration tools
  • DocAve migration tool (Prefer over Metalogix)

Does not matter what method you are using to migrate site collection, as long as it has been migrated to the webapp with SAME MMS, you could following the procedure listed above to fix the local terms. We will discuss other use cases including site collection migrated to webapp with different MMS later

Term Stores in SharePoint 2010

June 23, 2014

Managed metadata is a hierarchical collection of centrally managed terms that you can define, and then use as attributes for items in Microsoft SharePoint Server 2010.

Terms and term sets

term is a word or a phrase that can be associated with an item in SharePoint Server 2010. Aterm set is a collection of related terms. You can specify that a Microsoft SharePoint Server column must contain a term from a specific term set. Managed metadata is a way of referring to the fact that terms and term sets can be created and managed independently from the columns themselves.

Local term sets are created within the context of a site collection. For example, if you add a column to a list in a document library, and create a new term set to bind the column to, the new term set is local to the site collection that contains the document library.

Global term sets are created outside the context of a site collection. For example, the term store administrator could create a term set group called “Human Resources” and designate a person to manage the term set group. The group manager would create term sets that relate to Human Resources, such as job titles and pay grades in the Human Resources term set group.

Users can see only global term sets and term sets that are local to the user’s site collection.

Issue

There is an interesting scenario or situation that would arise when we use the Global term sets.  In most of the enterprises, there would be a QA/Test SharePoint Farm and the Production farm.

All the development / content creation activities happen in the QA farm and then later would be pushed to the production farm for consumption.  In this scenario, there is no out of the box mechanism to push the term store from QA to production.  Even the content deployment will not help you here.

A site collection in the QA farm consumes the term store (Managed Metadata Service) of the QA farm.   When you create a column in a list of type Managed Metadata, then it consumes the local Managed Metadata Service to bring the terms.

Please note the special icon – for the Technology column.  You can explore the different term sets by clicking on this icon.

Once the item is saved to the list, SharePoint populate a hidden list with the item selected for the Technology column.  This list is called Taxonomy Hidden list and the URL to open the list ishttp://URL-of- the-site-collection/Lists/TaxonomyHiddenList/AllItems.aspx.

If you edit the item that gets created in the hidden list you see the following screen.

Internally we store the term using some unique ID’s and that’s the reason the term doesn’t resolve when the backup of the site collection is restored to a new farm.

If you take the backup of this and restore in the production, then the list columns which uses the term store will only show the data and you would not be in a position to edit it as the same term store is not available in the production farm.  The following screenshot shows this scenario.

The term ‘Search’ is in a disabled state and it shows the data as it is present in the taxonomy hidden list.

Resolution

The resolution to the above described problem is to export the Taxonomy term store from the source / QA farm and restore it in the destination.  Once it is restored, you have to link the column in the list to the restored term store through the List settings.

Export the MMS term store from the source and restore it in the destination.

===================================================================

#Export

$mmsApp = “4a867ce5-d9ee-4051-8e73-c5eca4158bcd”; # this sets the exporting MMS ID

MMsProxy=”GUID”   # this sets the exporting MMS Proxy ID

Export-SPMetadataWebServicePartitionData -Identity $mmsApp -ServiceProxy $mmsproxy -Path \\ServerName\Share\MMS.bak ;

#Import

$mms2 = “d045d3ce-e947-4465-b039-0dfbbe24fb22″   #this sets the importing MMS ID

$mms2proxy = “GUID”   # this sets the importing MMS Proxy ID

Import-SPMetadataWebServicePartitionData -Identity $mms2 -ServiceProxy $mms2proxy -path \\ServerName\Share\MMS.bak -OverwriteExisting;

Reference

To get the MMS ID run the Get-SPServiceApplication command

Example:

PS C:\> Get-SPServiceApplication

DisplayName          TypeName             Id

———–          ——–             –

Access Services      Access Services W… 9d4b0b22-d351-468a-8877-ec4682eba6e6

Secure Store Service Secure Store Serv… 75d4a963-9bdc-412c-a10c-b8089e958cee

State Service        State Service        8bf67a48-21db-4c5b-9fda-482a5b337849

PerformancePoint … PerformancePoint … 6571a4d0-68c2-439a-909c-c978ad3940ce

Visio Graphics Se… Visio Graphics Se… 0f4f3b22-f329-4132-839b-7dca8f162086

taxonomy         Managed Metadata … 4a867ce5-d9ee-4051-8e73-c5eca4158bcd

PS C:\> Get-SPServiceApplicationProxy  – To get the Proxy id for the MMS

===================================================================

Sharepoint Benefits and Buisness Case

April 29, 2014

1. Reduced cost of Licensing

•  Cost efficient as compare any solution in the marke.

It also utilize the already investment of enterprise such as Windows Servers SQL Server Microsoft Office and Windows clients.so you end up with only few licenses requirements for Servers & CALs.

2. Greater ROI

•AIIM 2010 SharePoint report, sheds some positive light on
SharePoint ROI, with 68%of organizations that have implemented SharePoint experiencing expected, or better than expected, returns on investment..

3. Lower TCO

•    SharePoint have lowest Total Cost of Owner-ship
•    How?
•    by utilizing the already available infrastructure in the
organization,
•    faster development (SPD , VS2010)
•    lower deployment cost
•    Easily available technical resource in market.

4. Balanced Scorecards

  •  It facilitate the organization to build BI delivery Platform powered by SharePoint Performance Point ServicesExcel Services SSAS SSRS and Power Pivot.
  •   SharePoint Dash Boards and Performance Point services focuses across  An organization’s financial and non-financial measures(metrics).
  • Simply if you cant measure your business you cannot run it successfully.

5. Dash boards for management

•    Facilitate customized dash board with help of SharePoint
WebParts
•    Target dash board to every individual or groups with
Audience Targeting.
6. Future Road Map

  • SharePoint is here to stay, investments in SharePoint are safe as Microsoft is strongly committed to evolve SharePoint as single platform for the Enterprise of future.
  • Since many Server solutions are already merged in the product as we seen Content Management Server and Performance Point Server.

7. Key Performance Indicators – KPI

•    SharePoint KPI lists;  End user can populate KPIs by getting data from
•    Lists
•    Database
•    Tables
•    or \Excel Sheets
•    Could be displayed in dash board via web-parts.

8. Share Data Across geographical boundaries.

•    Web based platform easily accessible from world wide web.
•    As well as from browser supported mobile phones
9. Lower Development Cost

Built in templates and variety of third party support reduce the development cost.

Easily find the technical resource in the market.

10. Offline access to data

•    SharePoint Workspace: Possibility to work offline and synchronize with online   content later.
•    Microsoft Office Mobile Workspace also supported.
•    Two way syncing with Microsoft Outlook.

11.Websites for every business entity

  • Each entity or department will have different website
  • Built in templates supported
  • Business user (Knowledge User) can create the websites their own
  • Provide building blocks for the creation of Internet and Intranet Portals.
  • Develop separate portals for clients and partners.

12. Create workflows with ease

  • Empower Knowledge User and manager to create workflows without writing any peace of code
  • Create Share Point workflows from available templates OOB support.
    Build custom workflows to serve unique business need through SharePoint Designer.
  • Ability to tailor built in workflows.

13. Collaboration between Teams

  • OOB collaboration features supported
  • Team Sites, Work Spaces
  • Shared Libraries, Calendars,
  • Social Networking, Blogs, Wikis, Discussion Boards
  • Tasks List & Project Tasks
  • Survey & voting.

14. Web Editing

  • Easy and speedy site editing using browser based tools.

15. Rich Media Support

  • Rich Media Support: Including pictures, audio and videos.

16. Collaborate with partners and suppliers & customers

  • Through SharePoint extranets & FBA extend web applications and desired sites of SharePoint to be accessible to your partners, customers and suppliers.
  • Claims based authentication to let partners and clients logged in your extranet.

17. SharePoint Alerts

  • Alerts prior to achieving deadlines or over change events.
  • Two types of alerts supported
  • SMS
  • Emails

18. Enterprise Content Management (ECM)

  • Manage Content Lifecycle From Creation to Disposition.

19. Business Process Automation

  • Accelerate shared business processes across SharePoint Farm.
  • Workflow is natively supported in SharePoint
  • As well Supported through development tools proprietary to Microsoft. VS2010 Windows Workflow foundation
  • Ability to integrate with third party tools
  • Now more and more organization moving towards SharePoint for their BPM startagey.
  • Can migrate Line of business (LOB) data into SharePoint and run workflow over it.

20. MS Office Integration
One of the major reasons why SharePoint is best choice when it comes to Enterprise Content Management and Knowledge base and Business Intelligence delivery platform is native MS office Integration

  • Provides more productivity to end users (knowledge workers)
  • Sync Document Libraries with Office Outlook allow auto update changes made offline.
  • Take SharePoint Site offline with you (MS Workspace 2010)
  • View SharePoint contact lists and tasks list within Outlook
  • Keep up to date information track change history by subscribing RSS feed through Outlook.

21. Announcements to get rid off bulk Send To Emails

Announcements list can be used in-spite of sending the same email to every user across enterprise.

  • Reduce the usage of emails back & forth by using
  • Document workspaces
  • Discussion boards

22. Regulatory Compliance
•Regulatory compliance through comprehensive control over content.

23. Enhanced collaboration features
•Blogs, Wikis, Discussions, Social tagging, rating and bookmarking etc.

24. Personal website for every user

•My Site – Individuals can share and can make share information they way they want

•Can organize daily activities

• Store private files unshared with any body else.

25. Document versioning and retention after changes

•OOB support for documents versioning and retaining the drafts • Support Major and Minor versions. •Check In and Check Out of documents •Document retention unless approved by the approver

26. Simplicity of solution ease of use and user adaptability

•Microsoft Office like Ribbon User Interface provides ease of use and user adaptability.

•MS Ribbon UI provides context sensitive dynamic tool bar not showing every command at once.

•SharePoint Ribbon UI provides the identical interface of MS office ribbon UI.

27. Empower end users and improve their productivity

•Enhance the overall productivity of your employees through virtual office. •Empower your power users to create SharePoint objects such as •Sites •Lists •Document Libraries •Workflow. Without the knowledge of any technical details

28. Managing Projects with SharePoint

  • Team Site : Single location to keep project’s all artifacts (in Doc Libraries) and information.
  • Wikis: Create powerful pages of information to quickly and simply store all project relevant data
  • Manage Project tasks through Project Tasks List
  • Track Project status through SharePoint stop filling out MS Word Status Report.
  • Find the Right People for your Project utilize SharePoint Enterprise Search and My Site.
  • Leverage the OOB Project Tracking db over SharePoint site to share data, Reports, Forms and Queries.

29. Managing Projects with SharePoint (continued)

  • Dash Boards: build Power full Dash Boards to display project information.
  • Monitor & Analyze: your projects Key Performance Indicators (KPI).
  • Document Work Space: where project team could prepare document working close together. i.e. RFPs, Procurement Plan.
  • Discussion Boards: direct discussion at SharePoint away from emails.
  • Opinions & Advices: Get team opinions and advices by doing surveys at SharePoint.
  • Document Sets keep all the Project related information in one file one place (document set) web page associate project related meta data to it.

30. Uniquely define security over every single item

  • An Item level Access Control over SharePoint objects such as:
  • document libraries,
  •  lists,
  • individual folders
  • Folders
  • List items

31. Enforce Taxonomy
•SharePoint Meta Data services which allows term sets to be shared across a farm.

32. Knowledge Management
•Knowledge sharing is essential in organization
• Make all the vital information available to the entire organization in a matter of just few clicks (SharePoint wiki pages wiki libraries and wiki-sites).

33. Information security & access privileges

•SharePoint Users & Groups,

• Information Rights Management,

• Audience Targeting.

•SSL secured

34. Business Continuity & minimum Downtime

  • Support High Availability through multiple Web front end deployments
  •  SQL Server Clustering.
  • Backup and Restore at multi level through different approaches:
  • SharePoint CA
  • Power Shell
  • STS ADM
  • Site Collection Admin

35. Performance and Scalability over tremendous business growth

  • Network Load Balancing (NLB)
  • Running services on different servers for the same Farm
  • Natively web based environment improves accessibility across geographical locations.
  • It grows as your business grows.

36. Users Authentication

  • Built in AD Authentication
  • Database profile security (FormsBased Authentication) authenticated against database,
  • Claims based Authentication Mix mode authentication support AD authentication for employees and Forms Based authentication
    (user profile DB) authentication for partners vendors and clients as well open ID, Live ID and third party authentication also supported.

37. Visual Upgrade

  • Users can still use the SharePoint 2010 with SharePoint 2007 UI means that if you have those type of users who dont love the change you could still give them same look and feel of SharePoint 2007 User Interface and have the option to upgrade the UI to ribbon base toolbar with newly designed masterpages.

38. Integrate with custom built applicationIntegration with custom built applications (IT)

  • Integrate custom built ASP.NET Apps into SharePoint•  Native support in Visual Studio 2010 built in application templates and artifacts.•  Single Sign On (Secure Store Service) to map the application ID with the authenticated users ID so they dont need to authenticate for using each application from the SharePoint.

    •    Sandboxed Solutions help you to run your custom applications from control environment where you could closely monitor there performance and resource usages. Help you not to impact the overall performance of your SharePoint Farm.

39. Business Intelligence

Deploy SQL Server Reporting with SharePoint 2010 mixed mode.

•  Create reports in BIDS and host over SharePoint site.

•  Performance Point Services help you to create Business Dashboards from the Dash board designer as well as to create balanced Score Cards and KPIs

•  Excel Services to publish excel  based reports and data over SharePoint

•  Visio Services to publish Visio based diagrams over SharePoi

•  BI webparts building blocks for your dashboards along with OOB Chart Control.

40. Office Web Apps

Office Web Access

•  Enable users to access document from any where.

•  View share and work with other users online

through personal computers or mobile phones.

•  Built on the notion of anywhere access and easy share

•  Install separately on SharePoint 2010 runs as service and enabled as feature

41.Centralized access to  non Microsoft Data LOBs ERP, CRM

Through the BDC (SharePoint 2007) or BCS (SharePoint 2010) IT Professionals can allow end users to connect

•  Non Microsoft Databases i.e.    ORACLE 11g, IBM DB2, MySQL

•  Custom Applications

•  Web 2.0 Blogs & Wikis

•  Web Servics

•  ORACLE EBS, Siebel, SAP ERP, CRM

SharePoint 2013 Migration & Intranet Portal Development questionnaire

April 29, 2014

Questionnaires

Question 1:

What are the pain points in the current Intranet website, and its environment kindly specify each?

Question 2:

Do you have enterprise applications must be integrated with the SharePoint Platform if any kindly specify what are they?

Question 3:

Do you have a requirement or a solution for business workflows?

Question 4:

What is the number of End Users going to use the Intranet Portal?

Question 5:

What is the total number of user licenses available to you for SharePoint?

Question 6:

In how many geographic regions will users of the SharePoint 2013 platform reside?

Question 7:

Will we need to define new content for the site? Who are the content owners?

Question 8:

What purposes your SharePoint 2013 implementation will fulfill or to put in other way; what you looking at by implementing SharePoint 2013  is it Enterprise Content Management (ECM) solution Portal solution, team sites, document libraries, collaboration, search, business intelligence, all features)?

Question 9:

What version of Exchange Server is in place (deployed) currently 2013, 2010, 2007 or Exchange Online?

Question 10:

Do you want to integrate SharePoint 2013 with your Exchange for sending receiving email, alerts at this SharePoint 2013 implementation?

Question 11:

What version of MS LYNC is in place LYNC (deployed) currently 2013, LYNC 2010, OCS 2007 or LYNC online?

Question 12:

Do you want to integrate SharePoint 2013 with your MS LYNC for instant messaging, VOIP calls from SharePoint 2013, employee presence and status and voice and video conferencing at this SharePoint 2013 implementation?

Question 13:

What other content management solutions do you use in Client Company?

Question 14:

What version of Office is deployed in?

Question 15:

Do you have an internal IT team that will works on maintaining and customizing a SharePoint Server 2013?

Question 16:

Does Client Company requires the high availability at Database Server level? Does they have database SQL Server Failover Cluster or database mirroring if no then which type of other high availability has adapted for enterprise class applications?

Question 17:

Does Client Company have large BLOB (images, audio, and multimedia) objects? What is the approximate size? Does SharePoint 2013 requires to use remote storage (RBS) for BLOB or uses BLOB cache on Web-front End Servers (WFEs)?

Question 18:

Is the current SharePoint 2013 deployment required only Arabic Language or do you have Multilanguage requirements in Client Company such as Arabic and English is there any other language requirement as well kindly specify? Which languages do you need to support in SharePoint 2013 deployment?

Question 19:

Number of employees profile on Active Directory (AD) roughly estimates?

Question 20:

Does user profiles should be imported other than the Active Directory (AD). What are the number of sources and what are they? Kindly specify?

Question 21:

Does the current SharePoint 2013 deployment requires to have the My Sites available for the employees?

Question 22:

Does Client Company have/ own the licenses for SharePoint 2013 as well as for related technologies such as Windows Server 2012, SQL Server 2012 etc. otherwise we could purpose you licensing in the proposal.

Question 23:

Do you have the required hardware (i.e. servers) for implementation? Otherwise, you want us to add in to the proposal.

Question 24:

Are you looking for Virtual environment for deployment, or entirely physical we recommend to use at least SharePoint 2013 WFEs in virtual environments such as Hyper-V based on Windows Server 2012. What is your current environment for hosting other applications is it completely physical, mix or highly virtualized (DBs & Web Servers on VM)?

Question 25:

Is Intranet Portal for Employees have application or modules in it such as time attendance, task management, employee services (HR docs) etc. kindly specify each?

Question 26:

Does custom build Line of Business Applications (LOBs) hosting required on SharePoint 2013?

Question 27:

Number of required InfoPath 2013 based applications or self-service applications based on Info Path Form Services (IFS).

Question 28:

Number of Third Party web-parts deployed or custom made web-parts on your current Intranet Portal

Question 29:

Do you need to automate some of business process using Third party workflow solutions such as NINTEX or K2 or any other kindly specify?

Question 30:

Custom Workflow developed with Visual Studio (Windows Workflow Foundation) kindly specify details?

Question 31:

Numbers of Custom Workflows required to develop by SharePoint Designer (SPD) kindly specify details?

Question 32:

Do you need to provision My Site in order to take benefits of Enterprise Social Networking?

Question 33:

Do you need to provision (facilitate) excel services in order to benefit from the Excel related features in SharePoint 2013?

Question 34:

Is Performance Point Services is required to use for Business Intelligence for building Dashboards contains KPI and Scorecards?

Question 35:

Is InfoPath Services is required to use for developing forms for your SharePoint 2013 deployment?

Question 36:

Is SQL Server Reporting Services SSRS is required to host reports in SharePoint 2013?

Question 37:

Is SharePoint 2010 Enterprise Search feature required in New SharePoint 2013 Portal?

Question 38

Is Search is required to configured to Crawl File Servers if yes specify what are these sources and their details such as type of content to crawl, size etc.?

Question 39

Is Search is required to crawl Business Data (within the Database) through Business Connectivity Services (BCS)? Kindly specify Number of Servers and number of databases needs to be queried?

Question 40

Does Client Company needs to search over Microsoft Exchange Public Folders?

Question 41

Does Client Company need Integration with ERP or any accounting system fetching and writing data back to ERP such as ORACLE E-Business Suite, SAP or Dynamics AX, GP, NAV please specify details?

Question 42

Does Client Company need Integration with any CRM system such as ORACLE Siebel, Dynamics CRM kindly specify details?

Question 43

Does Client Company requires any Integration with any Microsoft Application based on Windows Forms, ASP.NET if any kindly specify details?

Question 44

Does Client Company requires any Integration with Open Source applications such as PHP MySQL if required kindly specify details?

Question 45

Does required single sign on through SharePoint for connected applications through SharePoint 2013 Secure Store Service (SSS) successor of Single Sign-On (SSO) provisioning how many applications require it?

Question 46

What is current version of Windows Server Client Company is using for Active Directory (AD) Domain Controller (DC)?

Question 47

What is the volume of data that will be stored on the system New SharePoint 2013 deployment kindly rough estimation?

Question 48

Does the solution need a controlled publishing process? Controlled publishing process includes a defined process for authoring, approval, and content deployment?

Question 49

Does the solution needs specific requirements around isolation of content authoring and content consumption environments if yes it requires the separate environment for staging before publishing to production (two farms or two separate deployments).

Question 50

Do you need to use social computing features of SharePoint 2013 in your Intranet Portal?

Question 51

Do you have any custom solutions that integrate to backend LOB applications or data sources?

Question 52

What version of client operating system (OS) and browsers end users are using at Client Company?

Question 53

Is the source code and documentation of current Intranet is available?

Question 54

Do you have training requirements for the SharePoint 2013 for your technical staff (IT Staff) as well as end users (business users) in order to increase the Return on Investment (ROI) over SharePoint 2013 technology?

Question 55

Do Client Company requires Outlook, Word, Excel, PowerPoint web access in SharePoint 2013 deployment?

Programmatically Adding and Removing Web Parts in SharePoint 2010

December 17, 2013

///

<summary> /// Adds a web part to a web page into the given web part zone ID and the given zone index

/// </summary>

///Web Site to add the web part to

///Web page to add the web part to

///Web part to add to the given web

///Web part zone to add the web part to

///The index at which the web part should be added to the web part zone.  Defines order

public static void AddWebPart(SPWeb web, string page, System.Web.UI.WebControls.WebParts.WebPart webPart, string zoneID, int zoneIndex)

{

SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(web.Url + “/” + page, PersonalizationScope.Shared);

 

webPartManager.AddWebPart(webPart, zoneID, zoneIndex);

webPartManager.SaveChanges(webPart);

 

web.Update();

 

}

///

<summary> /// Remove a web part based on its title

/// </summary>

///Web site to remove the web part from

///Web page to remove the web part within

///Title of the web part(s) to remove

public static void RemoveWebPart(SPWeb web, string page, string webPartTitle)

{

SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(web.Url + “/” + page, PersonalizationScope.Shared);

 

IEnumerable webPartList = from System.Web.UI.WebControls.WebParts.WebPart webPart in webPartManager.WebParts

where webPart.Title == webPartTitle

select webPart;

 

foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in webPartList)

{

webPartManager.DeleteWebPart(webPart);

}

 

web.Update();

}

 

SharePoint 2010 Search

December 16, 2013

Referred From:

http://sharepointfieldnotes.blogspot.in/2011/07/sharepoint-2010-search-scopes-explained.html

Search scopes enable users to narrow their searches based on content sources, web addresses, and metadata. This makes it easier for the user to search. Scopes are an integral part of the search user interface allowing users to choose a scope before performing a search query. Scopes can also be used to pre-configure search web parts such as the Search Results Web Part.

What is a Search Scope?

Scopes can be considered pre-built search criteria that are logically “AND” to users’ searches. They represent specific content or topics that are common or important to users. For example, you can define a scope for items that relates to a particular group in the organization such as Human Resources (HR) or Marketing. You can also create a search scope that encompasses several other scopes. In addition, you can set search scopes at both the search service application level and at the site administration level. Search scopes set at the service application level are available to all sites and site collections within the service application. These scopes cannot be modified or deleted at the site administration level.

A scope is made up of a title that the user sees when choosing it from a Search Web Part. The description describes what the scope represents. This is for administrative purposes. The Target Results page gives you the ability to use the Default Results page or specify a Custom Results page.

The rule represents the condition or criteria for defining the subset of content. Rules can have different types of conditions and behaviors. An administrator can create a complicated scope by chaining together different rules. This lets users easily append complicated query conditions to their searches.

Scope Rule Types

There are four search scope rule types.

  • Web Address Rules –  This type of rule can incllude content in web sites, file shares, exchange public folders, or any other content in the search index that has a URL. These can include the following.
    1. Folder – Includes items in the folder and subfolders that pertain to the indicated path.  With SharePoint URLs you can create rules that include or exclude different elements, such  as a site or a particular folder.
    2. Host Name – Limits content to a particular server name.
    3. Domain or Sub Domain – Limits content to a specific, fully qualified domain name such as contoso.com.
  • Property Query Rules – Limits content where a managed property is equal to a certain value. Only managed properties that have the “Allow this property to be used in scopes.” option checked can be used to limit content.
  • Content Source Rules – Enables you to limit content to a particular content source. This is useful if your service application has numerous content sources and you want to limit the scope to just a SharePoint content source or more granular types of content sources such as My Sites or Team Sites.
  • All Content Rules – Includes all content. Enables the construction of a more complicated scope that includes many rules. For example, you can combine this rule with an Exclude Content source rule. By doing so, the scope contains all content except possibly a file share content source.

Scope Rule Behaviors

Scope rule behaviors enable administrators to combine multiple rules together using simple logic. This simple logic enables administrators to create precise subsets of content. The recommended limit for the number of rules per scope is 100 or 600 per service application.

There are three types of rule behaviors:

  • Include – Any item that matches this rule is included, unless the item is excluded by another rule. Use this option to apply an “OR” rule.
  • Required – Every item in the scope must match this rule. Use this option to apply an “AND” rule.
  • Exclude – Items matching this rule are excluded from the scope. Use this option to apply an “AND NOT” rule.

Search Scope Example

An administrator can create multiple rules for a scope to define a precise set of content.

The above example illustrates how SharePoint evaluates the rules contained in a scope and determines what content is included.

All Include rules are applied with an OR; the required rules are applied with an AND; and the Exclude rules are applied with an AND (NOT ..).

For example, as a site administrator you can create a scope to limit a user’s query to match only documents in the team site, or have a title of Monthly Budget, and are not located in the archive site.

Rule Type Criteria Behavior
Web Address http://servername/teamsite Include
Property Title = “Monthly Budget” Include
Property IsDocument = 1 Required
Web Address http://servername/archivesite Exclude

If the user searches for a keyword of April along with the above scope, the actual query would look like this:

April AND ((Title = ‘Monthly Budget’ OR CONTAINS(Path, ‘http://servername/teamsite’) AND IsDocument = 1 AND NOT CONTAINS(Path, ‘http://servername/archivesite’))

SharePoint search scopes effectively build complicated filter conditions to determine the subset of content. They are logically appended with an AND operator to the user’s query. The user does not have to remember the complicated conditions to append the query, but only needs to remember the name of the scope.

Types of Scopes

There are two types of Scopes in SharePoint

  • Shared – Defined in the Search Service Application and can be used by all site collections in the farm associated with the Search Service Application.
  • Site level –  Defined at the site collection level by a site collection administrator and can be used only in the site collection

Shared scopes can be used across the farm by all site collections by defining the scope using the Search Service Application in Central Administration. The shared scopes are propagated to the site collections through a scheduled timer job, after which they become available to other site collections.

You can control what shared scopes are displayed in the site collection from the Site Collection Administration Search Scopes page.

On this page you can control what scopes can be displayed in either the Search Drop Down or Advanced Search Web Parts. This page can also be used to define site collection scopes that can be used only within the current site collection and sub sites. Shared scopes cannot be modified or deleted at the site administration level.

How Scopes Affect Search

Using scopes in a query can affect the performance. The default behavior is to execute scope rules during query execution when the number of rules is less than 25. This can increase the time it takes to return results. Scopes with rules greater than 24 are compiled and cached.

To speed up query performance, use Windows PowerShell to set a scope’s CompilationType to AlwaysCompile. However, this affects crawl performance because rules are evaluated during the crawl.

Windows PowerShell example:

$app = Get-SPEnterpriseSearchServiceApplication
$scope = $app | Get-SPEnterpriseSearchQueryScope -Identity “MyScope“
$scope.CompilationType = “AlwaysCompile“
$scope.Update()

How Scopes Affect User Search

Scopes enhance the user search process by making it easier for users to construct searches. Users can append keywords to a selected scope.

Complicated scopes can be constructed that make it easy for users to append keywords or property queries to a selected scope. Users do not need to remember all the rules behind a scope. Instead they need only recall the name of the scope and what it represents. This helps users find what they are looking for by segregating content into manageable and understandable subsets.

In addition, scopes can be used to direct users to custom search results pages to further enhance the search experience. However, to avoid confusion, care must be taken not to create too many scopes. Users must be educated on what each scope represents in order to use scopes effectively. Limit the number of scopes in the drop-down list to no more than 10.

How to Use Modal Dialog in Sharepoint 2010

July 28, 2013

Modal dialogs in SharePoint 2010 use the client library SP.UI.ModalDialog and showModalDialog. We can do the following within the context of a page without leaving the page:

  • Add and Edit metadata
  • Perform administrative task
  • Attach documents/files

The following step-by-step instructions show you how to implement a modal dialog in your server side pages:

1. Create a hyperlink that will be responsible for triggering your modal.

Set the onclick attribute as follows:

<a onclick="javascript:openDialog(); return false;" href="#">Open Attach File</a>

2. Implement the openDialog function in javascript.

<script type="text/javascript">

    // <![CDATA[
    function openDialog()
    {
        var options =
        {
url: http://server/_layouts/AttachFile.aspx?ListId={0F42F104-538C-4F3C-8098-0DD93C8CD779}
&ItemId=246
&Source=http%3A%2F%2Fdeadmines%2Fsites%2Fhorizon%2FLists%2FYear%2520End%2FMy%2520Inbox%2520%2520All%2520lists.aspx,
        width: 800,
        height: 600,
        title: "Attach File",
        };
    SP.UI.ModalDialog.showModalDialog(options);
    }
    // ]]>
</script>

3. Create hidden fields to store the information you will need to modify the url.

1
2
3
4
<input id="listId" type="hidden" />
<input id="itemId" type="hidden" />
<input id="sourceUrl" type="hidden" />
<input id="webUrl" type="hidden" />

4. Setup the hidden fields in your Page_Load event.

1
2
3
4
listId.Value = list.ID.ToString();
itemId.Value = listItem.ID.ToString();
sourceUrl.Value = list.DefaultViewUrl;
webUrl.Value = web.Url;</pre>

5. Use the hidden fields in the javascript function you wrote above.

<script type="text/javascript">

    // <![CDATA[
    function openDialog()
    {
        var options =
        {
        url:  $("#<%= webUrl.ClientID %>").val()+ "/_layouts/AttachFile.aspx?ListId=" + $("#<%= listId.ClientID %>").val() + "&ItemId=" + $("#<%= itemId.ClientID %>").val() + "&Source=" + $("#<%= sourceUrl.ClientID %>").val(),
        width: 800,
        height: 600,
        title: "Attach File",
        };
    SP.UI.ModalDialog.showModalDialog(options);
     }
    // ]]>
</script>
Ref:
http://www.sharepointdeveloperhq.com/2011/01/how-to-use-modal-dialog-in-sharepoint-2010/

Get a Web, List and Library Inventory using PowerShell

May 14, 2013

To run against a site collection:

Get-SPSiteInventory -Url http://spsite -SiteCollection
To run against a web application:

Get-SPSiteInventory -Url http://spwebapp -WebApplication

 

function Get-SPSiteInventory {
Param(
[string]$Url,
[switch]$SiteCollection,
[switch]$WebApplication
)
Start-SPAssignment -Global
if ($SiteCollection) {
$site = Get-SPSite $Url
$allWebs = $site.allwebs
foreach ($spweb in $allWebs) {
” – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – ”
$spweb.Url
$spweb.Lists | select Title, BaseType
$spweb.dispose()
}
$site.dispose()
}
elseif ($WebApplication) {
$wa = Get-SPWebApplication $Url
$allSites = $wa | Get-SPSite -Limit all
foreach ($spsite in $allSites) {
$allWebs = $spsite.allwebs
foreach ($spweb in $allWebs) {
” – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – ”
$spweb.Url
$spweb.Lists | select Title, BaseType
$spweb.dispose()
}
}
}
Stop-SPAssignment -Global
}