Thursday, April 23, 2009

SharePoint Audience User Existance Check sample

if HR is the audience.
GetAudience("HR") give access denied error.

Use the following
 using (SPSite site = new SPSite(SPContext.GetContext(Context).Site.ID))
 {
   ServerContext context = ServerContext.GetContext(site);
   AudienceManager audManager = new AudienceManager(context);
   SPUser user = SPControl.GetContextWeb(Context).CurrentUser;
   foreach(Microsoft.Office.Server.Audience.Audience objAudience in audManager.Audiences)
   {
     if (objAudience != null && objAudience.AudienceName == "HR")
     {
        if (objAudience.IsMember(user.LoginName))
        {
//Your code goes here
        }
      }
   }
}

Friday, April 17, 2009

Changing the Language of Sites

Pre-Req: Specific Language Pack Installed. ( Korean )

SW_CD_Office_Srvr_Language_Pack_2007_64Bit_Korean_1_1_PA_BP_SvrISO_Onl_X12-34584.EXE

For changing the language of all sites in the content database to Korean the query would be:

UPDATE dbo.Webs SET Language = 1042

Changing the language of one site collection can be done with:

UPDATE dbo.Webs SET Language = 1042 WHERE SiteId = [[SiteCollectionId]]

And for changing the language of a single web or subsite you can use:

UPDATE dbo.Webs SET Language = 1042 WHERE Id = [[WebId]]

Thursday, April 16, 2009

Installing Language Packs on 64-bit Sharepoint Farms

Install additional language files on all the WFE’s

On your front-end Web server, click Start, point to Settings and then Control Panel, and then click Regional and Language Options, on the Languages tab, in the Supplemental Language Support section, select one or both of the following checkboxes:

·         Install files for complex script and right-to-left languages

·         Install files for East Asian languages

Restart the Servers.

The following installation sequence should be followed.

Remember to unblock the downloaded software from the properties.

Cancel the Configuration wizard for the first 3 installations.

For the last installation run the configuration wizard and restart the servers. 

1. Windows SharePoint Services 3.0 Language Pack x64

http://www.microsoft.com/downloads/details.aspx?FamilyId=45FA2637-EFC0-4ED6-8F47-8A013E9CE9D9&displaylang=en

2. Windows SharePoint Services 3.0 Language Pack Service Pack 1 (SP1), 64-Bit Edition

http://www.microsoft.com/downloads/details.aspx?FamilyId=C7CF102B-5DD8-4D86-BE5A-D56F63EF37A4&displaylang=en

3. SharePoint Server 2007 Language Pack (x64)

http://www.microsoft.com/downloads/details.aspx?familyid=318d8562-58bd-4329-b1f6-f1941a38bc7f&displaylang=en&tm

4. The 2007 Microsoft Office Servers Language Pack Service Pack 1 (SP1), 64-Bit Edition

http://www.microsoft.com/downloads/details.aspx?FamilyId=56681742-7D2C-4A6F-9178-DACD32AADC6C&displaylang=en

SharePoint Master Pages

Do not use the CTRL (K+D) option from the VS 2008 for the master pages.
This option applies the indenting and space formatting for the language as specified on the Formatting pane of the language in the Text Editor section of the Options dialog box.

I have noted extra space appearing just by that

Wednesday, April 15, 2009

SharePoint Object Model - Discussion

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

namespace DiscussionBoardPoster
{
    class Program
    {
        static void Main(string[] args)
        {
            SPSite site = new SPSite("http://kopperla:2030/Movies");

            using (SPWeb web = site.OpenWeb())
            {

SPList list = web.Lists["Prince"];
                SPListItemCollection myListCol = list.Items;
                SPListItem disc = SPUtility.CreateNewDiscussion(myListCol, "Excellence2");
                disc["Body"] = "C Sharp is great";
                SPFieldUserValue oUser = new SPFieldUserValue(web, 289, "matcha");
                disc.Update();

                SPListItem reply = SPUtility.CreateNewDiscussionReply(disc);
                reply["Body"] = "I like C Sharp and VB.NET much";
                reply["Author"] = oUser;
                reply["Editor"] = oUser;
                reply["Created"] = DateTime.Parse("14 Jul 2006");
                reply["Modified"] = DateTime.Parse("14 Jul 2006");
                reply.Update();

                SPListItem reply2 = SPUtility.CreateNewDiscussionReply(reply);
                reply2["Body"] = "I like C Sharp and VB.NET too mubh";
                reply["Author"] = oUser;
                reply2["Editor"] = oUser;
                reply2["Created"] = DateTime.Parse("10/22/2008");
                reply2["Modified"] = DateTime.Parse("10/22/2008");
                reply2.Update();

                disc["Author"] = oUser;
                disc["Editor"] = oUser;
                disc["Last Updated"] = DateTime.Parse("10/22/2008");
                disc["Created"] = DateTime.Parse("10/22/2008");
                disc["Modified"] = DateTime.Parse("10/22/2008");
                disc.Update();


            }

        }
    }
}

Wednesday, April 8, 2009

Installing Adobe PDF iFilter 9 for 64-bit platforms

1. Download Link: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
2. Add Path C:\Program Files\Adobe\Adobe PDF iFilter 9 for 64-bit platforms\bin) to the Environmental Variables. Dummies Steps below.
(Right-click MyComputer)->Properties->Advanced->Environmental Variables->System Variables
selct PATH and click Edit, Click End button to reach the end to avoid replace.
Add ;C:\Program Files\Adobe\Adobe PDF iFilter 9 for 64-bit platforms\bin
Click OK, Ok, Ok to apply the changes and to close the System Properties Window
3. Restart the machine
4. Follow the steps in the following link. - Simplified version of the following version coming soon.