Wednesday, April 28, 2010
Changing the Webpart properties programatically
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
namespace webpartproperties
{
class Program
{
static void Main(string[] args)
{
SPSite spsSite = new SPSite("site");
SPWeb spwWeb = spsSite.OpenWeb();
spwWeb.AllowUnsafeUpdates = true;
SPWebPartCollection wpcWebParts = spwWeb.GetWebPartCollection("site", Storage.Shared);
foreach (WebPart wptWebPart in wpcWebParts)
{
//Console.WriteLine(wptWebPart);
if (wptWebPart.GetType().ToString() == "webpartname")
{
PropertyInfo[] pinProperties = wptWebPart.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo pinProperty in pinProperties)
{
string name = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
if (pinProperty.Name == "your property name")
{
pinProperty.SetValue(wptWebPart, "select ", null);
wpcWebParts.SaveChanges(wptWebPart.StorageKey);
Console.WriteLine(pinProperty);
}
}
}
}
Console.ReadLine();
}
}
}
SharePoint 2010 Documentation for Developers
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c010fc68-b47f-4db6-b8a8-ad4ba33a35c5
SharePoint 2007 vs SharePoint 2010
Feature Name / Area | SharePoint Server 2007 | SharePoint Server 2010 |
Sites |
|
|
Office Integration | Included | Improved |
Line-of-Business Integration | Included | Improved |
Read/Write capabilities |
| New |
Enterprise Management Operations | Included | Improved |
Management tools and reporting | Included | Improved |
Web Analytics |
| New |
Mobile Connectivity | Included | Improved |
Full-fidelity viewing |
| New |
Editing to mobile |
| New |
Office Interaction | Included | Improved |
Read/Write capabilities | Included | Improved |
Robust User Experience | Included | Improved |
Contextual Ribbon |
| New |
Microsoft Silverlight |
| New |
Office Web Applications |
| New |
Tagging |
| New |
Audience Targeting |
| New |
Communities |
|
|
People profiles | Included | Improved |
Photos and presence |
| New |
Microblogging |
| New |
Ask Me About |
| New |
Note Board |
| New |
Recent activities |
| New |
Organization Browser |
| New |
Add colleagues | Included | Improved |
Social bookmarks |
| New |
Tags |
| New |
Tag clouds |
| New |
Tag profiles |
| New |
Blogs | Included | Improved |
Wikis | Included | Improved |
Enterprise wikis |
| New |
Ratings |
| New |
Colleague suggestions | Included | Improved |
Keyword suggestions |
| New |
Content |
|
|
Compliance Everywhere |
| New |
Flexible Records Management |
| New |
Shared Content Types and Managed Metadata Service |
| New |
Content Organizer |
| New |
Rich Media Management |
| New |
Document Sets |
| New |
Word Automation Services |
| New |
Support for Accessibility Standards |
| New |
Search |
|
|
People and expertise search | Included | Improved |
Search from Windows 7 and Windows Mobile | Included | Improved |
Common connector framework for indexing and federation | Included | Improved |
Scale and performance via improved topology architecture | Included | Improved |
Ability to build search-powered applications | Included | Improved |
Refinement panel and sorting |
| New |
Search in context |
| New |
Social behavior improves relevance |
| New |
Thumbnails, previews, and view in browser |
| New |
Advanced content processing with strong linguistics |
| New |
Insights |
|
|
KPI details |
| New |
Dashboard Designer | Included | Improved |
Enhanced navigation, including filtering and sorting (top/bottom 10, switchable measures) |
| New |
Publish more workbooks |
| New |
JavaScript Object Model |
| New |
PowerShell scripting |
| New |
Richer fidelity with Excel workbooks |
| New |
Support for Analytical Services formatting |
| New |
Additional data sources, including external lists and "PowerPivot" workbooks (naming to come) |
| New |
Improved strategy map connection and formatting |
| New |
Seamless management of dashboard content | Included | Improved |
Integrated filter framework |
| New |
Calculated KPIs |
| New |
Improved visualizations |
| New |
Chart Web Parts |
| New |
Business Intelligence Center |
| New |
Composites |
|
|
Browser-based customizations | Included | Improved |
Business Connectivity Services |
| New |
SharePoint Designer | Included | Improved |
Human workflows | Included | Improved |
Forms Services | Included | Improved |
Visio Services |
| New |
Access Services |
| New |
Sandboxed Solutions |
| New |
Wednesday, April 21, 2010
Add data to Person or Group field type programatically
txtusername.Text=System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
and give the captured logged in user to the person or group field. But, we get an error because person or group field is readonly field. we can add the logged in user to person or group field type using the following line
listitem["Name"] =web.Users[txtusername.Text];
using (SPSite site = new SPSite("yoursite",systoken))
{
using (SPWeb web = site.OpenWeb())
{
site.AllowUnsafeUpdates = true;
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["yourlist"];
SPListItem listitem = list.Items.Add();
listitem["user Email"] = web.Users[txtusername.Text].Email;
listitem.Update();
list.Update();
web.AllowUnsafeUpdates = false;
site.AllowUnsafeUpdates = false;
}
}
Scheduled Tasks in Windows server 2008
After so many trails, I have fixed the issue by running the task as Administrator. It worked fine in windows server 2008 by running as administrator.
Tuesday, April 13, 2010
Impersonation in SharePoint 2007
using SPSecurity.RunWithElevatedPrivileges all the time will not work, In that context better using .net Impersonation.
Here's the code snippet for impersonating a different user:
SPUser user = SPContext.Current.Web.AllUsers[@"DOMAIN\LOGINNAME"];
SPUserToken token = user.UserToken;
using (SPSite site = new SPSite(SPContext.Current.Site.Url,token))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["YourList"];
list.Items[0]["Title"] = "Your new title";
list.Items[0].Update();
}
}
Wednesday, April 7, 2010
Error message when you click the "Edit this Task" button on an e-mail message in Microsoft Office Outlook 2007
following is the link from Microsoft Support about this problem.
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B968469&sd=rss&spid=11335
Monday, April 5, 2010
Ghosted and Unghosted Pages in SharePoint
SharePoint web sites can contain two kinds of pages: Ghosted and Unghosted
Ghosted Page in SharePoint
A ghosted page is a page in SharePoint website which is not stored in the database instead it reference to a file which exists in the server’s file system. These reference files are common for all the website/site collection within that SharePoint server, i.e., if you modify a reference file then that change will reflect in all the websites/site collections within that SharePoint server automatically. So we can say these reference files are used as template.
The default master page of SharePoint “default.master” is a well known example of ghosted page. “default.master” page is located in the directory “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global”. If you do some changes in the “default.master” then this change will automatically reflect in all the websites within that SharePoint server.
To create a new site in SharePoint, a site template is used. Site template contains description of all the pages, webparts within the pages, master page used, custom lists, etc. for the web site to be created. You can define a page ghostable in the “onet.xml” file of the site template.
Unghosted Page in SharePoint
All the pages in a SharePoint website which are stored in the content database are referred as unghosted pages. All the unghosted pages are specific to that SharePoint website only, i.e., changes done in an unghosted pages will not reflect in other websites within that SharePoint server.
If a new website is created with a site template which contains a page defined as “unghostable” in the “onet.xml”, then that page will be stored in the content database of new website created and will not reference to the page available in the site template folder.
If a ghosted page is modified in the SharePoint designer, it will become unghosted. For example if a master page is customized in SharePoint Designer, SharePoint stores a modified version of the master page in the content database and also it breaks the reference to the “default.master” file on the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global“.
mysites: evaluation version of sharepoint server 2007 has expired
This is not because of licensing issue. This is a sharepoint bug.
solution:
- Open up the registry editor and find the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0 collection.
- Add read permissions for the WSS_WPG and Full permissions for WSS_ADMIN_WPG.