keep track and sharing on my sharepoint knowledge :) nice to meet you all
which country user step here?
Tag Cloud
Sunday, December 6, 2015
Excel 2013 - Getting challenged for username and password
Background story :
We are using SharePoint 2010 and have several Excel spreadsheets that have data connections in them that use a SharePoint list to refresh data (not using excel services). The Excel spreadsheets are stored in a SharePoint document library and the site is a trusted location. All of our users have at least read access to the library as well as the SharePoint lists where the data is stored. Some of the lists are coming from a site that is in a different site collection than where the Excel spreadsheet is stored.
Our problem is this: Our users that are running Excel 2010 can open and refresh the data just fine. Our users running Excel 2013 are constantly challenged for user name and password (it does not accept it when it is entered) and the data does not refresh. The error message is "A connection to the SharePoint site cannot be established. To synchronize or refresh your table, you must be able to connect to the SharePoint site". Then it tells you which data range failed to refresh. When you click OK, it goes on to the next connection that it cannot connect to and repeats the process until you have gone through all of the connections.
No permissions have been changed and these users could access the spreadsheet before being upgraded to Office 2013. They are using Windows 7, Service Pack 1. I am the farm administrator and am able to open the spreadsheet in Excel 2013. I've tried increasing the user's permissions but it still won't open for them.
Solution :
Grant the permission to user/group to the SitePages Document Library
URL Discussion :
https://social.technet.microsoft.com/Forums/en-US/23c7f5ed-0041-451e-834f-0652c87af67d/sharepoint-2010-and-excel-2013-getting-challenged-for-username-and-password?forum=sharepointgeneralprevious&prof=required
Thursday, September 24, 2015
Better explanation than Technet about Export-SPWeb
this site look like not so helpful for me to export the list ...
i prefer this more detail site explanation :
http://blog.blksthl.com/2013/09/05/export-a-document-library-using-export-spweb-and-itemurl/
===========================================================================================
SharePoint 2010 | SharePoint 2013
Export-SPWeb [-Identity]
Export-SPWeb http://site –Path "c:\temp\site export.cmp" -ItemURL "/subsite/documents"
site export.cmp' in the ‘C:\temp’ directory.Wednesday, September 14, 2011
Code to retrieve all the list item detail
using System;
using System.Linq;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointServices.Samples
{
class RetrieveListItemsInclude
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";
ListItemCollection collListItem = oList.GetItems(camlQuery);
clientContext.Load(collListItem,
items => items.Include(
item => item.Id,
item => item.DisplayName,
item => item.HasUniqueRoleAssignments));
clientContext.ExecuteQuery();
foreach (ListItem oListItem in collListItem)
{
Console.WriteLine("ID: {0} \nDisplay name: {1} \nUnique role assignments: {2}",
oListItem.Id, oListItem.DisplayName, oListItem.HasUniqueRoleAssignments);
}Console.ReadLine();
}
}
}
source code from here
Thursday, August 25, 2011
Metadata navigation > new SharePoint Server 2010 feature that enables users to dynamically filter lists
Metadata navigation is a new SharePoint Server 2010 feature that enables users to dynamically filter lists so they can find what they need. Metadata navigation enables users to select filter options, and it handles performing the query in the most efficient manner possible. Metadata navigation consists of two parts. One part is a set of navigation controls that let a user filter a list that has navigation hierarchies and key filters. The second part is a mechanism for rearranging and retrying queries.
Metadata navigation has retry and fallback logic that attempts to perform queries efficiently by using indexes. If a query will return too many results, the query falls back and returns a subset of the results for better performance. If no appropriate query can be made, fallback occurs and the filters are performed on a limited set of results. Metadata navigation automatically creates indexes. Together retry, fallback, and index management make metadata navigation a very important part of working effectively with large lists. There are two kinds of filtering mechanisms: navigation hierarchies and key filters.
Navigation hierarchies use a tree control to navigate hierarchies of folders, content types, choice fields, or managed metadata term sets. This enables users to use a tree control to pivot on a metadata hierarchy, much as how they navigate folders. When users select an item in a hierarchy for a managed metadata column, all items that match the specified term or any of its descendant child terms are displayed. This is called descendant inclusion, and it can be used on fields that are tied to a managed metadata term set. Users can select the item again to filter on only that particular term and not include the descendant child terms. All metadata navigation queries are recursive and display results from all the folders in the list.
Key filters can be configured to perform additional filtering of results within the hierarchy. For example, you can add the Modified By column as a key filter and then type a user name to obtain results where Modified By matches the entered user. For more information, see Metadata navigation and filtering (http://go.microsoft.com/fwlink/?LinkId=219154). The following figure shows an example of metadata navigation hierarchies and key filters.
from : http://technet.microsoft.com/en-us/library/cc262813.aspx
Wednesday, July 6, 2011
Change the name of the button name on SharePoint list
Renaming the menu items in SharePoint Site Libraries and Lists for a Specific Site
Author: Samarendra Swain
In SharePoint document Library/List we find menu items like New, Uploads, Actions and Settings etc. At times there might be requirements to rename these menu items for a specific site. The following Javascript function can be used to achieve the objective.
The code snippet shown below can be called from inside the specific SharePoint Page.
e.g AllItems.aspx page inside a Document Library/List.
This javascript function needs to be called on Page load event using _spBodyOnLoadFunctionNames.push method.
<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("renameMenuItem('New', 'My New')");
_spBodyOnLoadFunctionNames.push("renameMenuItem('Settings', 'My Settings')");
function renameMenuItem(oldMenuItemName, newMenuItemName)
{
var vAnchorTag;
var vAllAnchorTags = document.getElementsByTagName('a');
if(oldMenuItemName.length!=0)
{
for (var j = 0; j < vAllAnchorTags.length; j++)
{
vAnchorTag = vAllAnchorTags[j];
if (vAnchorTag.innerText.indexOf(oldMenuItemName)!=-1)
{
vAnchorTag.innerText = newMenuItemName;
try
{
if(newMenuItemName.length != 0)
{
vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt
= newMenuItemName;
}
else
{
vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt
= oldMenuItemName;
}
}
catch(err)
{
}
}
} // End For
} // End If
}// End Function
</script>
Thursday, April 21, 2011
Only with Document library permission is unable to subscribe Alert me!
Issues :
user only have full control permission at document library, when user try to click on alert me setting then will show Error: Access Denied
Root cause:
this is by design on Microsoft product or maybe is bug :D
When you click on the Alert me you will route to the page sites/abc/_layouts/XXXXX , which is needed read permission at site level.
Solution:
1. Grant user view permission at site level. > if allow user to see other information
2. If user using client Microsoft outlook 2007 then can direct sync the folder to outlook ( if have any new document upload then you will see unread document at outlook)
3. Admin can help user add the alert.
Wednesday, March 23, 2011
SharePoint List filter with [Null] ?
thinking to find any parameter is available to Filter by empty Field at SharePoint list. But i found one article , is not with Null….is with nothing to compare mean is null!! ha ha..let me share it at below :
http://www.endusersharepoint.com/2009/01/23/filter-by-an-empty-field/
I ran into a little quirk this morning that turned out to have an interesting solution. When authors submit articles to the Article Submission Library at EndUserSharePoint.com, there is a date column named “Actual Publication Date” to compare against the “Scheduled Publication Date”.
I want to create a view that shows only the articles that have not been published.
My first pass used the filter section to say “Show items when Actual Publication Date is greater than 1/1/2008″. I figured since it was a date column, any item that had a date in that field would not show up in the view. Nope… didn’t work.
Then I thought “What if you filter for an empty field?” So this time, I set filter to “Show items when Actual Publication date is equal to” and left the value field empty…. Score!!!
Weird one… don’t compare against the date, just leave the filter value empty. You learn something new everyday.
Wednesday, February 16, 2011
Introduction to customizing pages by using Web Parts
WSS list is so useful for business user, can do something simple system by the simple list and filter :D. i am start thinking should i be business personnel rather then SharePoint engineer? ha ha ha , ok, just keep tract this article from Microsoft , i am sure one day i will consult user to user this :D
This article is intended for Web page owners and administrators. It provides an overview of Web Parts and Web Part Pages and explains how you can customize a page by adding, changing, or deleting Web Parts.
- Overview of Web Parts and Web Part Pages
- Types of Web Parts
- Ways to use Web Parts and Web Part Pages
- Web browser support for Web Part Pages
Overview of Web Parts and Web Part Pages
A Web Part is a modular unit of information that forms the basic building block of a Web Part Page. You can add Web Parts to Web Part zones in a Web Part Page and then customize the individual Web Parts to create a unique page for your site users.
The following example uses the Image Web Part to describe the basic features of a Web Part.
The Web Part title bar contains the heading for the Web Part.
The Web Part menu contains functions that enable you to minimize or close the Web Part, edit the Web Part, or get Help for a specific Web Part. When the page is in edit mode, you can also use this menu to delete the Web Part or connect it to other Web Parts, depending on the type of Web Part that you are using.
The body of the Web Part contains the content that you specified for the type of Web Part that is being used. In this example, the Web Part is an Image Web Part, which displays an image.
A Web Part Page is a special type of Web page in which you can use Web Parts to consolidate data, such as lists and charts, and Web content, such as text and images, into a dynamic information portal that is built around a common task or special interest.
Your site home page is one example of a Web Part Page. When you create a new site or workspace site, you are creating a Web Part Page. You can also create a Web Part Page by selecting one of the available site templates, or you can use a Web design program that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer 2007, to create a Web Part Page from scratch.
You can use a Web Part Page to present a variety of structured and unstructured information in an organized, useful, and convenient way. Web Part Pages often contain several Web Parts that are connected so that you can dynamically display data and content to see the results that you want.
For example, you can create a Web Part Page called Customer Orders that you frequently use to display critical information. You get a call from a customer who has a question about an order, does not remember the order ID number, but does remember the date when the order was placed. You can use a Web Part Page to do the following.
Look up an order by order ID number or, in this case, the order date.
Display all orders by date.
Select the correct order, based on the customer's name, and look up the order details as well as the customer details.
Select a line item in the order (in this case, the lamp), and display a product picture to confirm the customer's question.
Scan for late-breaking business news that is pertinent to the customer's order.
WEB PART PROPERTIES
Each Web Part shares a set of common properties (also called base class properties) that are organized into sections in the tool pane and that control the Web Part's appearance (such as the title, height, and width), layout (such as the Web Part order in the zone and the direction of the content), and advanced characteristics (such as the image icon and description).
Many Web Parts also have custom properties that are unique to the Web Part. These are usually displayed either above or below the common Web Part properties in the tool pane. For example, the Image Web Part has additional custom properties, including the image link, its horizontal and vertical alignment, and background color.
NOTE Depending on how the Web Part was created, a Web Part custom property may be displayed in a default Miscellaneous section below the common properties in the tool pane.
WEB PART VIEWS
You can customize a Web Part in one of two views:
- Shared view You can add a Web Part to a Web Part Page and then edit the Web Part Page in a shared view. Shared Web Parts are available to all users of a Web Part Page who have the appropriate permission.
- Personal view You can add a shared Web Part to your own personal view and then edit your view of the Web Part. The changes that you make to a Web Part while you are in a personal view are available only to you. Other users who did not make changes in a personal view continue to see the shared view of the Web Part.
The view of the Web Part that you are working with can be important because:
- You may have permission to edit only some Web Parts on certain Web Part Pages but not on other Web Part Pages.
- You may be able to connect to certain Web Parts on a Web Part Page but not to other Web Parts on the same Web Part Page.
WEB PARTS AND WEB PART CONNECTIONS
An additional feature of Web Parts is the ability to easily connect them by passing data between them and synchronizing their behavior. By connecting Web Parts, you can manage data in dynamic and interesting ways. In many products and technologies, the task of connecting sets of data from different data sources is not easy and often requires programming skill. But with Web Parts, making data connections is as simple as using menu commands. By connecting Web Parts, you can, for example, present data from two Web Parts in alternate views, perform related calculations between two Web Parts, and filter a Web Part by using values from another Web Part — all on one Web Part Page.
WEB PART ZONES AND THEIR PROPERTIES
Web Part zones are containers of Web Parts that are used to group and organize Web Parts on a Web Part Page. Web Part zones also have a set of properties that serve a dual purpose. You can use one subset of properties to organize the layout and format of Web Parts on the Web Part Page. You can use another subset of properties to provide an additional level of protection from modification (or "lock down") of the Web Parts within the zone.
The Web Part zone properties each have default settings or behaviors. As you add Web Parts to the Web Part Page, some of these property values are automatically set. These property values are not designed to be edited in the browser, but you can edit them by using a Web design program that is compatible with Windows SharePoint Services, such as Office SharePoint Designer 2007.
For more information about Web Part zone properties, see the Windows SharePoint Services 3.0 SDK, which is available from the Windows SharePoint Services Developer Center on MSDN.
Types of Web Parts
Windows SharePoint Services provides several Web Parts that are ready to use with your site. You can use these built-in Web Parts, customize them to suit your needs, or create new Web Parts and upload them for use throughout your site.
DEFAULT WEB PARTS
The following Web Parts are included by default in any site and can be customized to suit the needs of your team. Many of these Web Parts can also be connected to each other to create a variety of unique solutions:
- Content Editor Web Part You can use the Content Editor Web Part to add formatted text, tables, hyperlinks, and images to a Web Part Page.
- Form Web Part You can use the Form Web Part to connect to and filter a column of data in another Web Part. Both Web Parts must run on the same server.
- Image Web Part You can use the Image Web Part to add a picture or graphic to a Web Part Page. To more easily coordinate the image with other Web Parts on the page, you can control the vertical alignment, horizontal alignment, and background color of the image inside the Image Web Part by editing its custom properties in a shared view.
- List View Web Part You can use the List View Web Part to display and edit list or library data on your site and to connect to other Web Parts, including other List View Web Parts. Lists are information that you share with team members and often display in tabular format. List views display this information in different ways for different purposes, such as filtering, sorting, or selecting specific columns.
NOTE There is no Web Part called List View. When you create a list on your site, a List View Web Part is automatically created and named after the list. For example, if you create a list called Boats, a Web Part called Boats will be available in the Site Name gallery. The Web Part automatically displays the data contained in the list that you created.
- Page Viewer Web Part You can use the Page Viewer Web Part to display a Web page, file, or folder on a Web Part Page. You enter a hyperlink, file path, or folder name to link to the content.
- Site Users Web Part You can use the Site Users Web Part to display a list of users and groups who have permission to use a site. The Site Users Web Part automatically appears on the home page of a Document Workspace site. You can also add the Site Users Web Part to any Web Part Page.
NOTE In sites that are running on Microsoft Windows SharePoint Services 2.0 and earlier, the Site Users Web Part was called the Members Web Part.
- XML Web Part You can use the XML Web Part to display Extensible Markup Language (XML) and apply Extensible Stylesheet Language Transformations (XSLT) to the XML before the content is displayed. For example, you might have an XML file that contains a list of boats, prices, and links to images of the boats. You can use the XSLT to transform the data to display a list of boats and prices and make the boat name a hyperlink to display the image in a separate window.
PRECONFIGURED LIST VIEW WEB PARTS
The following Web Parts are built into the Windows SharePoint Services team site template and are automatically configured and ready to use on a Web Part Page when you create a new team site. Different combinations of these Web Parts are included when you create a team site or workspace site, depending on which site template you select.
NOTE These Web Parts are derived from the List View Web Part and use preconfigured Web Part templates to create their unique layout and design. To add data to these lists, on the Quick Launch, click View All Site Content, and then clickLists. On the All Site Content page, click the name of the list for which you want to add data.
- Announcements Use the Announcements Web Part to post news, status, and other short bits of information that you want to share with team members.
- Calendar Use the Calendar Web Part to display upcoming events or team schedules.
- Links Use the Links Web Part to post hyperlinks to Web pages that interest your team.
- Shared Documents Use the Shared Documents Web Part to share files from the default document library with site users.
- Tasks Use the Tasks Web Part to assign a task to a member of your team, specify its due date and priority, and indicate its status and progress.
- Team Discussion Use the Team Discussion Web Part to provide a forum for talking about topics that interest your team.
CUSTOM WEB PARTS
By using a programming environment that is compatible with Windows SharePoint Services, such as Microsoft Visual Studio, developers can exploit the full feature set of Microsoft ASP.NET to create custom Web Parts. A Web Part Page is an ASP.NET file (.aspx), and Web Parts are derived from Web Form Controls. To further enhance Web Part Pages, developers can create their own Web Parts that provide new functionality. Developers can also add custom properties to the Web Parts, add custom builders in the tool pane for specialized user interfaces, and connect to other Web Parts by using Web Part connections. For more information about creating and deploying Web Parts, see the Windows SharePoint Services 3.0 SDK, which is available from the Windows SharePoint Services Developer Center on MSDN.
You can also use Web Parts that other people or companies have created. You must have appropriate permissions to add a third-party Web Part to your Web Part Page or site. Some Web Parts may need to be deployed directly to the server. If you are unable to add a third-party Web Part to your Web Part Page or site, contact your administrator for assistance.
Ways to use Web Parts and Web Part Pages
You can use Web Part Pages in the following ways:
- Consolidate data from different data sources.
- Report and summarize critical data.
- Analyze and aggregate data (for example, sums, totals, or counts).
- Summarize key information that you want to see at the beginning of each day.
- Prioritize and highlight project or customer data to help you make effective decisions.
- Display an up-to-date work schedule and meeting information to quickly plan your day.
- Get quick access to business news, local weather, and your favorite Web sites to focus your Web browsing.
WAYS TO CREATE AND CUSTOMIZE A WEB PART PAGE
There are several ways to create and customize a Web Part Page:
- The New Web Part Page form The most common way to create a Web Part Page is through the New Web Part Page form. On the Site Actionsmenu
, click Create, and then click Web Part Page to open the New Web Part Page form. After using this form to create a page, you can begin designing the page right away in the browser. When you want to browse through the page, just close the tool pane.
- A Web design program By using a Web design program that is compatible with Windows SharePoint Services, such as Microsoft Office SharePoint Designer 2007, you can make advanced customizations to a Web Part Page, including the following:
- Customize the theme of a Web Part Page that uses the site theme by default.
- Edit a Web Part Page template or create a new one.
- Customize the page layout.
- Edit zone properties.
- Add HTML code or Web controls.
- Change the way Web Parts are ordered inside a zone.
- Add Web Parts outside a zone, or add a Web Part to a Web page that is not a Web Part Page.
- Create connections between Web Parts on different Web Part Pages.
- Publish a Web Part Page to a Web site that is running Windows SharePoint Services.
- Customize the Form Web Part and use the Data View Web Part.
Web browser support for Web Part Pages
Web browser support for Web Part Pages can be categorized into two levels:
- Level 1 support is the highest level of visual and functional support. Browsers that provide level 1 support include recent versions of Microsoft Internet Explorer for Microsoft Windows.
- At level 2 support, a few visual and functional features are not available to some browsers, and some other features are compromised and behave differently from the way they behave in level 1 browsers. However, the majority of features are still available to users. Browsers that provide level 2 support include Firefox 1.5 and later for Windows and Netscape Navigator 8.0 and later for Windows. Level 2 browsers are not supported for Windows SharePoint Services 3.0 Central Administration.
NOTE Level 2 browsers do not support the creation of connections between Web Parts.
Tuesday, October 19, 2010
Unable to reorder content type
Have user copy the list template from another site and want to reorder the content type, when click on the column order at the content type you will see the error :
Object reference not set to an instance of an object. at Microsoft.SharePoint.ApplicationPages.ChangeFieldOrderPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Work around:
you will not be able to manage the order of your columns on the list settings page again until you switch “Allow management of content types” back to No. When the management of content types if enabled, you can then reorder the columns for each specific content type. You may or may not want this to be your standard setup, so my best practice here would be to turn this feature back off when you are finished managing the content type.
Detail step:
1. change the list setting at Advanced settings and change the Allow management of content types to no. > click ok
2. under the column, you will see Column ordering. Click on the column ordering and change the order.> click ok when you done
3. change the list setting at Advanced settings and change the Allow management of content types to yes > click ok
guessing of the root cause:
i think because the content type is attach to the template and no content type created for the sites. once you click on ordering, then will go to search the content type gallery at site level. once cannot found it and error message will show at above. i guess is consider bug :)
Wednesday, October 6, 2010
Filter the calendar of today event
The start time at calendar Filter is not available then we cannot use [Today] to filter the item. In this case you just created one column and select Calculated (calculation based on other columns) then Formula =[Start Time].
after that you can edit the view with filter on column you created is equal to [Today]:
In this example , i created column name as DOB.
Friday, October 1, 2010
How to Move Large SharePoint Document Libraries
Faced some problem to move large SharePoint Document during migration , so found out the solution here.
Scenario : one document library is over 25GB so unable to use stsadm export and import.
Solution: have 2 post is same, so i not sure who is the owner. anyway just like to keep track on the coding and sharing here :) [This can move different farm :) ]
http://www.law.com/jsp/lawtechnologynews/PubArticleLTN.jsp?id=1202443237483
http://pravyns.blogspot.com/2010/08/how-to-move-large-sharepoint-document.html
EXPORT AND IMPORT WITH THE SHAREPOINT OBJECT MODEL
To accomplish the goal of copying an arbitrarily large document library, and only that document library, from one site to another, we'll need to use a bit of .NET code and the SharePoint object model. The code will perform two broad tasks:
- export the source document library to a set of one or more files on disk; and
- import the file-set created in step 1 to the target location.
You could write this code in a number of ways, but for simplicity, I'll create two .NET console applications: ExportDocLib and ImportDocLib. Both these applications must be run on the SharePoint web front-end server of the farm containing the source and target document libraries respectively.
ExportDocLib exports the source document library to operating system files. To create the application, open Visual Studio 2005 or later, and create a new C# console application. Next, add a reference to the Windows SharePoint Services .NET assembly, and then add "using" statements at the top of the program to reference the Microsoft.SharePoint and Microsoft.SharePoint.Deployment namespaces.
The rest of the code is fairly straightforward; you will need to provide references to the site collection and the web site within it that contains your document library (I simply referenced the RootWeb property of my site collection because my document library was contained in the top-level web site), a reference to the list to be copied, and information about where to create the export files and export log. I've also instructed SharePoint to retain the security via the IncludeSecurity switch, and to display progress to a command window as the program runs using the CommandLineVerbose switch. There are many other settings you can use, but those shown below are all you'll need for a basic list export:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Deployment;
namespace ExportDocLib
{
class Program
{
static void Main(string[] args)
{
// Get handle to web and doclib to export
SPSite site = new SPSite("http://localhost/sites/SITE1");
SPWeb web = site.RootWeb;
SPList list = web.Lists["Shared Documents"];
// Define export settings
SPExportSettings settings = new SPExportSettings();
settings.SiteUrl = "http://localhost/sites/SITE1";
settings.FileLocation = @"C:\Export Files\";
settings.BaseFileName = "SITE1.cmp";
settings.ExportMethod = SPExportMethodType.ExportAll;
settings.LogFilePath =
settings.FileLocation + "SITE1_export_log.txt";
settings.CommandLineVerbose = true;
settings.IncludeSecurity = SPIncludeSecurity.All;
// Add reference to document library to export
SPExportObject exportObject =
new SPExportObject(
list.ID,
SPDeploymentObjectType.List,
web.ID, false);
settings.ExportObjects.Add(exportObject);
// Export it
SPExport export = new SPExport(settings);
export.Run();
}
}
}
ImportDocLib is almost a mirror image of ExportDocLib. ImportDocLib will import the document library from the operating system files created by the ExportDocLib program. As before, start by creating a new C# console application in Visual Studio, adding a reference to the Windows SharePoint Services .NET assembly, and by adding "using" statements to reference the two Microsoft.SharePoint namespaces.
Next you'll create a SPImportSettings object and set its properties to define the location of the import files, the location of the site collection and web site where you want your new copy of the document library, and a location for the import log.
Although it’s beyond the scope of this article, the RetainObjectIdentity setting is noteworthy because its value will determine whether you can apply subsequent incremental imports to this same document library. For example, you could copy the full library once, and then periodically import only changed or new items from the source into the target library. To enable these subsequent imports, however, the RetainObjectIdentity setting must be set to "true." However, you may not set it to "true" if you will be importing a document library into the same content database as the source library, because all objects in a SharePoint database must have unique object IDs. The most likely scenario for which you would use the RetainObjectIdentity switch is to create a copy of a document library on a different SharePoint farm, and subsequently to refresh that second library with updates from the original.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Deployment;
namespace ImportDocLib
{
class Program
{
static void Main(string[] args)
{
// Settings for import
SPImportSettings settings = new SPImportSettings();
// File & path
settings.FileLocation = @"C:\Export Files\";
settings.BaseFileName = "SITE1.cmp";
// Site and web to import to
settings.SiteUrl = "http://localhost/sites/SITE2";
settings.WebUrl = "http://localhost/sites/SITE2";
// Set log file location
settings.LogFilePath =
settings.FileLocation + "SITE2_import_log.txt";
// Display messages while running
settings.CommandLineVerbose = true;
// Don't retain object GUIDs, only necessary
// if want to do incremental imports to same list
// at a later time
settings.RetainObjectIdentity = false;
// Keep security, versions, and date/time stamps
settings.UpdateVersions = SPUpdateVersions.Append;
settings.UserInfoDateTime =
SPImportUserInfoDateTimeOption.ImportAll;
// Import it
SPImport import = new SPImport(settings);
import.Run();
}
}
}
You might correctly observe that both the ExportDocLib and ImportDocLib routines can be combined into a single program. This would simplify the process in that you wouldn't need to execute two separate programs to complete the copy process. But when copying a document library from one SharePoint farm to another, you will need to run ExportDocLib on a WFE server in the source farm, and the ImportDocLib on a WFE in the target farm. Keeping them separate gives you the flexibility you need in such instances.
CONCLUSION
With just a bit of .NET coding you can copy document libraries of arbitrary size from one site to another, within or between farms, without the need to purchase a third-party product. With a bit of additional coding you can add the capability of applying incremental updates from a master document library to a copy, thus keeping the secondary library in synch.
At Fenwick & West we have found this technique invaluable for migrating large document libraries between SharePoint farms, filling the gap between the built-in capability to save small libraries using a list template, and backing up full site collections using the backup and export functions of STSADM.
Thursday, September 23, 2010
Tech insight 2010 Penang
22-23 Sept 2010 at USM penang, so far for the SharePoint related session only have 3 but this also help to increase some sharepoint 2010 knowledge.Today have one session is sharing on the SharePoint list Improvement , is look great a lot limitation user cannot get now already available.
Example,
- unique column ( something like primary key for the list , cannot duplicate)
- validate the columns ( using excel formula)
- Lookup Field Relationship Behavior – behavior that can be enforced includes; Project multiple fields into a child list; Joins between lists, Relational integrity between child and parent lists – this brings up new possible security issues & considerations
- List Relationships & Data Integrity – one-to-many allows you to trigger cascade delete and restrict delete
- more detail you can get from here
ok let me finish the tomorrow session then will share more :)
Wednesday, March 18, 2009
How to embed the HTML/Java Script to your SharePoint list?
learnt this from Path to SharePoint , let me do some summary of the step i have learnt:
- Creat the custome list with following column:
- City: text column (San Diego)
- Country_City: text column (USA_SanDiego)
- Model: choice column (0012, etc.)
- Color: choice column (dkblue, ltblue, blue, red, silver, green, magenta, etc.)
- Clock: calculated column with the following formula:
="<DIV><embed src='http://www.clocklink.com/clocks/"&Model&"-"&Color&".swf?TimeZone="&Country_City&"' width='150' height='150' wmode='transparent' type='application/x-shockwave-flash'></DIV>"
yeah!!! you are done!!
<script type="text/javascript">
//
// Text to HTML
// Feedback and questions: Christophe@PathToSharePoint.com
//
var theTDs = document.getElementsByTagName("TD");
var i=0;
var TDContent = " ";
while (i < theTDs.length) {
try {
TDContent = theTDs[i].innerText theTDs[i].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTDs[i].innerHTML = TDContent;
}
}
catch(err){}
i=i+1;
}
//
// ExpGroupRenderData overwrites the default SharePoint function
// This part is needed for collapsed groupings
//
function ExpGroupRenderData(htmlToRender, groupName, isLoaded) {
var tbody=document.getElementById("tbod"+groupName+"_");
var wrapDiv=document.createElement("DIV");
wrapDiv.innerHTML="<TABLE><TBODY id=\"tbod"+ groupName+"_\" isLoaded=\""+isLoaded+ "\">"+htmlToRender+"</TBODY></TABLE>";
var theTBODYTDs = wrapDiv.getElementsByTagName("TD"); var j=0; var TDContent = " ";
while (j < theTBODYTDs.length) {
try {
TDContent = theTBODYTDs[j].innerText theTBODYTDs[j].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTBODYTDs[j].innerHTML = TDContent;
}
}
catch(err){}
j=j+1;
}
tbody.parentNode.replaceChild(wrapDiv.firstChild.firstChild,tbody);
}
</script>
For the clock detail you can go to clocklink.com , check out what the country time and clock style and colour you want add to your list...then you will see it!!
Tanks to Chrisophe of this sharing !! [yeah , the world is flat]
Tuesday, January 27, 2009
Displaying a list on another site (in the same site collection)
here have one work around for you to import the list data and show at your site. I know this solution is not 100% as the web part list view , but this able to help you show the data.
if you really don't like this method , you can add in web part view then show the list from the original sites :) (i don't like this solution, the view is not so nice :) ha ha)
ok, here is the detail link for the method : Link
Summary of the step:
- open the sites (the site you want to show the list) by using Sharepoint designer
- Data view --> Insert data view
- select "Connect to another library..." ( key in the list url you want to share)
- OK, now do the customize for you data source
- Done (ha ha ha, if not clear about it please refer the detail at the Link)
Friday, July 11, 2008
How to use the Calclated coloumns at MOSS list
example you have one list as below:
| Number in rom (for user to edit) | Number in English (this is calculated type column) |
| 1 | One |
| 2 | Two |
| 3 | Three |
what you need to do is just create the column at the list with name Number in english, type in the formula as below:
=IF([Number in rom]="1","One",IF([Number in rom]="2","Two"), IF([Number in rom]="3","Three"))
Done!!
so user every time edit the data at Number in rom , the second column will auto change.