Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

Sunday, June 28, 2015

Create List View by filtering Month in SharePoint

Create a calculated filed with
=YEAR(Created)&"-"&CHOOSE(MONTH(Created),"01. January","02. February","03. March","04. April","05. May","06. June","07. July","08. August","09. September","10. October","11. November","12. December")

http://guru-web.blogspot.ae/2006/02/some-of-my-favourite-date-wss-list.html

Wednesday, December 30, 2009

Variations in MOSS2007

From Last few months i have been working on WCM features for one of the world class intranet portal. Especially on PageLayouts for publishing article pages,List templates,Site Definition ,Conent Types,WebParts,Social sites from NewsGator and Variations.
In this post I would like to explain how to implement multilingual on MOSS.
1. Open the Site Settings of the top-level site and click on Variation Settings.
2. On the Variation Settings page

3. In the Site Settings page, click now on Variation Labels.
A. Click New Label and create the source label.
B. Enter English as the label name.
C. Set English as the display name.
D. Set the local to English (United States)
E. Check Set this variation to be the source variation.
F. Select appropriate site template
(In the below screencast we are using custom site definition)
G. Click OK.

4. Like that we r using 10 variation Labels

Based on the profile settings and browser settings default locale page would open.User can select required language based on the user control

Friday, October 30, 2009

The site collection could not be restored!!!

I have been doing base line of my application in my VM.I have two site collection in my web application. Each has its own database…
I got the following error while doing restore site collection.

Resolution:
Delete the corresponding DB ,next recreate new DB for your site collection and try to restore again.
It should work

Wednesday, October 21, 2009

Error: The path specified cannot be used at this time. (Exception from HRESULT: 0x80070094)

While creating a web application on MOSS2007 environment i have been getting this error.
I didn't find out any errors related to this in Logs file.
Finally i did two steps
1)Restart the SharePoint Timer Services
2)IIS RESET.
Still i am getting this error...
Finally restart the server...
I know the last one is actually ridiculous but it helped.(My box RAM is 1GB,2 users are using this through remotely and N/W IP is slow and etc)
Trust me it should work!!

Wednesday, October 7, 2009

How to get value from resource file and set into a control in a ASPX page?

I have been struggling from past 2 days to fix this issue.
Luckly I got information from
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\ADMIN\CMSIncrementalMigration.aspx at 64 line.

<
It should work.Tx WSS Team...

Tuesday, September 1, 2009

Some of the key areas should know as a MOSS admin

I am giving some of the key points about the daily activities of a MOSS dev.
Reusing Sites
•Save site as template
•Works for all sites except publishing sites
•Default template limit 10 MB
▫Change via command line
▫Change to max of 500 MB
Stsadm.exe –o setproperty–pnmax-template-document-size –pv524288000
•Does not save security

Site Templates Usage
•Save Site as template
•Saved to Site Template Gallery
▫1 per Site Collection
Use Template Globally
•Deploy via command line
•Add Template
Stsadm–o addttemplate–filename YourFile.stp –title YourTitle–description YourDesc
•Delete Template
Stsadm–o deletetemplate–title YourTitle
•List Templates
Stsadm–o enumtemplates
•After running Add/Delete IISResetrequired
List Templates
•No option for deploying globally
Feature deactivation
▫Removes functionality
▫Does not remove data created by feature
Setting trust level
•Options
▫WSS_Minimal(default)
▫WSS_Medium
▫Full (built in .NET Policy)
Code Access Security in SharePoint 2007 for Administrators
SharePoint Web Parts run with a Trust Level which is set in the Web.Config file for the entire Web Application allowing not just one Web Part, but all Web Parts to run with that trust.
The default trust level that the Web Application runs with is WSS_Minimal. Developers will normally request that this is set to WSS_Medium or Full which are the only other configurations possible unless the developer creates a custom configuration file.
Code Access Security – The Architecture
In the Web.Config file for the web application you will see two Trust Level Elements in the Security Policy Element pointing to the two configuration files stored in 12\CONFIG (localdrive:\program files\common files\microsoft shared\web server extensions\12).
Each configuration file configures a number of classes by setting its properties. The classes are illustrated below.

The default Trust is WSS_Minimal which allows most code to run but would block your code from accessing SQL, The SharePoint Object Model, Environment Variables such as Machine Name and DNS etc. To allow these permission you would need to up the trust level to WSS_Medium, Full or to a Custom Policy. However, increasing the Trust Level for the Web Application would allow all Web Parts within that Web Application to run with more permissions. Best practice would be to create a custom policy and listing your web part in the file to run with the permissions it needs.
To create a new set of permissions you need to create a new file such as Custom_WSS_Medium.config and then make SharePoint aware of the file by pointing to it in the Web.Config for the Web Application. You can merge the settings in WSS_Minimal and WSS_Medium in your new Custom File to create your own permission set. It is advised not to change the original files as Microsoft may alter these files during the application of a Service Pack.

Each custom Web Part should be Strongly Named by the Developer which provides the DLL file for the Web Part with a Public Key. You can extract the Public Key using the SN tool provided by Visual Studio.NET: sn –Tp filename.dll
This will return the Public Key BLOB and the Public Key Token for the dll. Normally this would be a developer role as it requires Visual Studio.NET.

The Public Key Token is used in the Safe Controls entry in the Web.Config for the Web Part (Assembly) to register it as a Safe Control within the Web Application. The Public Key can also be used in the custom Trust Level Configuration File to give one particular Web Part or a group of Web Parts Full Trust whilst still leaving the Trust Level set to a minimal set of permissions.
To list a Web Part with Full Permissions within your Web Application whilst still retaining a WSS_Minimal permission set for all other Web Parts follow these steps:
1. Make a copy of the WSS_Minimal.Config file from the 12\Config folder and paste it into the same folder renaming it to Custom_WSS_Minimal.Config.
2. Edit the Custom_WSS_Minimal.Config file with an XML editor such as Visual Studio.NET or NotePad.
3. Obtain the Public Key Token and Public Key Blob for the Web Part assembly that you want to deploy using the following command: sn –Tp filename.dll.
4. Create a new entry in your Custom_WSS_Minimal.Config file for your Web Part:
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="My custom Strong name"
Description="This code group grants code signed with the “My Custom
Strong Name” strong name full trust.">
PublicKeyBlob="00240000048000009400000006020000002400005253413100040000010001009BC5B83BBD16C6ABB44BAB156CF9C55D1D67078CE98CE7B423C72EE91647BD73241BFC700192ED32481CA7CF06C205BD4C7BEDA3D4FA5ED5689AA23BC1C2118EBFA6018238AD5B4DA420FB335E6BECA9EDE5E3F53C4BFFF266411445AE7B1DDD14FB0F01C075589770EABD4B1D1A70F731C098F22EDE9838CC9783C73451B5"/>

5. Create a new TrustLevel element for your config file in the Web.Config called Custom_WSS_Minimal that points to your custom file in the 12\config folder.
6. Set the Trust Level of the Web.Config to Custom_WSS_Minimal
7. Recycle the Application Pool or run IISReset
8. Deploy & Test your Web Part.

Friday, June 12, 2009

How to resolve "Report Server has encountered a SharePoint error. (rsSharePointError)"

Unfortunately i have faced this error while integrating SSRS2005 with MOSS2007.
I googling a lot n finally i configured all the options once againg through RSCongfiguration Manager.

I have the issue with email settings.

U need to configure email setting properly.Other wise u would get the following error.

"An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) "

Once u did every thing properly u should Subscription through email.

Thursday, May 7, 2009

Patterns and Practices -> SharePoint Guidance

A well documented guidance around SharePoint Products and Technologies.
You can read more on the guidance here:
http://msdn.microsoft.com/en-us/library/dd203468.aspx
This guidance discusses the following:
-Architectural decisions about patterns, feature factoring, and packaging.
-Design tradeoffs for common decisions many developers encounter, such as when to use SharePoint lists or a database to store information.
-Implementation examples that are demonstrated in the Training Management application and in the QuickStarts.
-How to design for testability, create unit tests, and run continuous integration.
-How to set up different environments including the development, build, test, staging, and production environments.
-How to manage the application life cycle through development, test, deployment, and upgrading.
-Team-based intranet application development.

Thursday, April 30, 2009

How to write Custom Audit Entries in WSS3.0?

Last year i attend Ted's training on WSS3.0. He given all Lab and whitepapers which are published by him.I am reading one by one.
One article on Audit logging is awasome.
I would like to post the summary of the article.
Audit logs detailing events that track data such as which users viewed and updated records and documents, and when these events occurred.
Microsoft Windows SharePoint Services 3.0 (WSS 3.0) and Microsoft Office SharePoint Server 2007 (MOSS) provide support for auditing user access to pages, content, and documents, and includes auditable events such as viewing and updating.
While WSS provides the basic auditing mechanisms, MOSS adds value by supplying an administrative user interface that allows auditing at the site collection level. MOSS goes even further and enables auditing at the list or document library level, and control over what types of events should be recorded in the audit log. MOSS also provides a reporting function that uses Microsoft® Office Excel® workbooks to display and keep records of audit logs. Therefore, MOSS allows you to take advantage of the WSS auditing support without having to write any custom code.
// turn on auditing flags to a list
SPSite siteCollection = new SPSite("http://LitwareServer1");
SPWeb site = siteCollection.OpenWeb();
SPList list = site.Lists["Proposals"];
list.Audit.AuditFlags = SPAuditMaskType.View
SPAuditMaskType.Update
SPAuditMaskType.Delete;
list.Audit.Update();
The code is written to read the audit log of the current site collection by creating an SPAuditQuery object.
SPAuditQuery wssQuery = new SPAuditQuery(siteColl);
SPAuditEntryCollection auditCol = siteColl.Audit.GetEntries(wssQuery);

As you examine the implementation of the code that reads information from the WSS audit log, observe how it retrieves user names. The WSS audit log tracks user IDs but not user names. After you have obtained a user ID, you can retrieve the associated user name using the GetByID method on the SiteUser collection, which is exposed as a property of the top-level site. Make sure you use the SiteUsers collection; do not confuse this with the User collection, which does not provide the same results.
string GetUserNameById(int UserId, SPWeb site) {
return site.SiteUsers.GetByID(UserId).Name;
//return site.Users.GetByID(UserId).Name; - YOU CANNOT USE SPWeb.Users collection here

}

Writing custom audit entry
item.Audit.WriteAuditEvent(SPAuditEventType.Custom, "CustomViewAuditEvent", "");

Tuesday, April 21, 2009

Longitude for sharepoint

My best friend Sanjay has been working on Longitude. I go through his blog and find some cool stuff on MOSS Development.

Tuesday, April 14, 2009

How to increase the bandwidth of the Web-enabled forms?

Ans: Set Form Session State to Form view
Goto Central Administration > Application Management > Configure InfoPath Forms Services at the bottom sharepoint given the follwoing option

How to migrate of a MCMS 2002 to our MOSS 2007 environment?

As per my MCTS prepartion for Configuration i go through some of migration tool.
We need to migration tasks that need to be completed. For this purpose in CodePlex some tools r avilable. And one fine article on MSDN. Go through the following link.
http://msdn.microsoft.com/en-us/library/aa480227.aspx

Friday, April 10, 2009

How to deploy SSRS report into MOSS environment?

I got the chance to work on SSRS.I developed Emp Details Page Template and Leave Tracking details for one of my stakeholder. The data is storing in a Data Base Table. Using these data I am going to generate various reports. So as per my first attempt I did one sample report and I would like to explain how to deploy into Sharepoint environment.

Once i deploy the report it has show like the following shot.

Thursday, March 26, 2009

Renaming a SharePoint 2007 server

Hi today i configured my MOSS Server with 4GB RAM.But unfortunately i found the mistake that the formate of my system name.I have expected prob may occure.I renamed my system name.... Fuck....

Now i am unable to acess my CA site.

My face is blank.....

After Googling i found one wonderful aricle.

http://blog.sqlauthority.com/2008/09/09/sql-server-error-fix-sharepoint-stop-working-after-changing-server-computer-name/


Finally got it.
Tx Pinalkumar

Monday, January 26, 2009

How to add a new choice field using WSS Object Model?

SPList list = site.Lists["Demo"];
StringCollection choices = new StringCollection();
choices.Add("AP");
choices.Add("MP");
choices.Add("HP");
list.Fields.Add("State", SPFieldType.Choice, false, false, choices);
SPFieldChoice fldChoice = (SPFieldChoice)list.Fields["State"];
fldChoice.EditFormat = SPChoiceFormatType.Dropdown;
fldChoice.Update();
list.Update();

Monday, December 22, 2008

Determine the accounts you will need to install and configure MOSS 2007 Enterprise Edition?

Below you will find the list of accounts you will need and a suggested account name followed by a brief explanation of anything special about this account. You will be creating the accounts in AD.
1) Setup Account – SP_Admin – This is the account that you will log into the MOSS server to do the install and when you wish to administer the server. This account will need to be a local administrator on the MOSS server and be given the securityadmin and dbcreator roles from within SQL Server.

2) Farm Account – SP_Farm – This is the account that your farm will connect to the SQL Server as. It should only be a domain user. When you tell MOSS to use this account it will automatically set the account up as a dbcreator, securityadmin, and db_owner for all SharePoint databases.

3) WSS Search Service – SP_WSSSearch – This account is a domain user. SharePoint will automatically assign it read access to the configuration database and the content database for central administration.

4) WSS Search Crawl – SP_WSSCrawl – This account is a domain user. SharePoint will automatically grant this account Full read to the farm.

5) MOSS Search – SP_MossSearch – This account is a domain user. SharePoint will grant access to read the configuration database and read access to all content databases hosted in the farm. This will become you default content access account for crawling.

6) SSP App Pool – SP_SSPAppPool – This account is a domain user. SharePoint automatically gives this account db_owner for the SSP content database, read & write to all content databases associated with its SSP, read access to the configuration database, and read access to the central administration database.

7) SSP Service – SP_SSPService – This account is a domain user. Same permissions as the SSP App Pool

8) MY App Pool – SP_MyAppPool – This account is a domain user. This account will be used as the identity for the My Sites application pool. It will be granted db_owner to that content database, read access to the config and central administration databases, and read access to the associated SSP database.

9) Portal App Pool – SP_PortalAppPool – This account is a domain user. This account will be used as the identity for the portal application pool in the Module 3 lab. It will be granted db_owner to that content database, read access to the config and central administration databases, and read access to the associated SSP database.

Thursday, October 9, 2008

Web Part Maintenance Page

In some cases we need some way to close the offending web parts.In that case we go to the Web Part Maintenance Page.
For the Web Part Maintenance Page is to append "?contents=1" to the end of your web part page's URL and loading that page.
For example:
/sites/foo.aspx
/sites/foo.aspx?contents=1.

Monday, October 6, 2008

How to add Audience Targeting to a link at QuickLaunchBar?

I strugle a lot for setting a group to a link.So that the group users only can see the link at quicklaunchbar.
I would like to share a few lines...
if (userGroup == "Publisher")
{
node.Properties.Add("Audience", ";;;;" + groupName1);
node.Update();
}
else if (userGroup == "Certifier")
{
node.Properties.Add("Audience", ";;;;" + groupName2);
node.Update();
}

Sharepoint Interview questions

1-Question: can you create page layout templates in Visual Studio?Answer: Yes, but longer answer in the Page Layout module
2-Question: When using SharePoint designer for Page Layout Templates can you add code behind or reference an ascx file with a dll?Answer: You can... unfortunately it's not wired together as easily as you have when bulding ASPX pages in Visual Studio 2005. So what you do is create a class library and then specify which class the page inherits from in the Inherits attribute within the page's directive.
3-Question: Can we get the code for the "Minimal "publishing site template?Answer: Sure... just change the WSP file extension to CAB and you can easily extract it and see the contents. WSP's are just CAB files renamed as WSP's.
4-Question: I missed the extra step you did in extending the existing web app? did you just change the port?
5-Question: So the customized pages need to be placed under MPG(Master page gallary) & is ASP.Net master page same as MOSS master page?Answer: (1) If they are created using SPD, all masters and page layouts must be in the MPG... they can't be anywhere else. Once you open them and edit them, when you save them, they stay in the MPG as customised. (2) yes, you just have to have the sharepoint placeholder controls in your master page.
6-Question: is it possible to customize TOC for Press Releases by showing first couple of lines per press release?Answer: Yes... you'd just use the same technique you use for the Content Query Web Part by modifing the XSLT files or creating your own custom XSLT.
7-Question: I use createchildcontrols but find that sometimes it does not have values on post back so I have had to use oninitAnswer: At times you do need to add things to OnInit to register event handlers and such, yes that's correct.
8-Question: 1- How do you debug webparts? 2 - Is it performance consuming to have 3 content query webpart on a page (for the welcome page for an internet site)?Answer: (1) you manually attach the debugger to the w3wp.exe process...
9-Question: What are the best scenarios to use 1)Web Parts, User Controls, Application Pages please compare and contrast.Answer: Web Parts are good as "little applications", such as aggregation controls. In SharePoint we typically don't build many user controls, but you can do it. However, there's nothing special about SharePoint in deciding when to build user controls vs. Web Parts... it's the same decision process you'd have in an ASP.NET 2.0 site. As for application pages (which are deployed to the _layouts directory), these are good for pages you want to be avaialble to ALL sites in your farm as all sites share the same _layouts path.
10-Question: If I have an asp/net application (ie. showing mortgage rates), how do I install this in MOSS? Do I use WebParts or is there another technique?
11-Question: How can we better link lists together, we have primary keys in DBMS.. what about SharePoint lists/DocLibs?Answer: there's no relationship between sharepoint lists... but you can enforce this with event receivers.
12-Question: Is it possible to use infopath and aspx pages in the same workflow?Answer: Hmm... If you can use InfoPath forms, then you should beacuse they do so much heavy lifting for you!
13-Question: How can we deal with cases in which the approver did not respond in a timely manner?Answer: There are activities in the base activity library in WF that you can use to wake up your activity after a specified time... within this activity you can check how long it's been pending and either give them a reminder slap via email or you can change the approver and reroute it. But you'd have to this using custom workflows.

Friday, August 29, 2008

Break the permissions inheritance of a site

This code allows you to break the permissions inheritance of a site

string siteGroupNamePublisher = "SampleReadOnly";
string desc = "A group to manage read only user for root site";
siteCol = (SPSite)properties.Feature.Parent;
site = siteCol.RootWeb;
try {
SPSecurity.RunWithElevatedPrivileges(delegate() {
//Start--Creating SampleGroup which has read permissions n Break Inheritense
logFile.WriteInfo(CLASS, "FeatureActivated", "Creating SampleGroup which has read permissions n Break Inheritence", debugInfo);
SPGroup secGroup1;
SPRoleAssignment roleAssignment1;
SPRoleDefinition roleDefinition1;
site.SiteGroups.Add(siteGroupNamePublisher, site.CurrentUser, site.CurrentUser, desc);
secGroup1 = site.SiteGroups[siteGroupNamePublisher];
roleAssignment1 = new SPRoleAssignment(secGroup1);
roleDefinition1 = site.RoleDefinitions["Read"]; roleAssignment1.RoleDefinitionBindings.Add(roleDefinition1); site.RoleAssignments.Add(roleAssignment1);
//End--Creating SampleGroup which has read permissions n Break Inheritense
});