Vistors

Categories

Blog Stats

Archive for ‘MOSS’

Was wondering about the subject of the post which i am going to write. okay fine and its Double Hop Dogma. This is related to Exchange Web Services API. you can download the API from this link. Let me explain what happened. There was a requirement raised due to the fact that we cant view OWA websites (Outlook Webmail) inside an IFRAME. When we used the OWAInputWebPart the owa site used to display within the ifram of the OWAInputWebPart. Hence there was an exception saying that it cannot be displayed within IFRAME. So as a solution we had to develop our own custom web part to view the inbox emails.

Initially i was playing around with a single mail box and was able to fetch the mails without any problem. I refered this MSDN article for my reference.

So the above code works fine and was able to read the emails. As the next step the requirement was to read the emails based on the currently logged in user in Share Point. So started working on a new web part for this.

If you want to connect to EWS from a computer that is logged on to the domain, using the credentials of the authenticated user, set the UseDefaultCredentials property on the ExchangeService object to true.

// Connect by using the default credentials of the authenticated user.
service.UseDefaultCredentials = true;

i kept trying the above code to work but unfortunately it didn’t work. I spent full whole day trying on this. I searched on the web and found the blog post about the double hop dogma. it says “The user who’s browsing the application from a client machine passes his credentials to the IIS server, i.e. the credentials of the user hop from the client to the IIS server. Subsequent to that, when the IIS application executes EWS calls, it is supposed to pass those same credentials to the Exchange server, to authenticate the logged on user. This works fine in the ideal scenario, and falters in alternative scenarios.”

They have mentioned following scenarios related to the above sentence as below:

Ideal scenario: Kerberos authentication method is being used within the organizationFrequent Scenarios: The non-ideal scenario is not being observed, i.e. NTLM might be the active authentication mechanism, or Kerberos could be failing and the application falls back on attempting authentication via NTLM which would eventually fail in a double-hop situation.”

In my case when i checked the active directory structure on the client site, i learnt that they are not using the Kebreros authentication instead they are using the NTLM authentication on AD.

So i came across the blog post : Need a way to authenticate to Exchange Web Services and based on the fact which explains that: “Create a service account that has either impersonation rights or delegate access over the employee mailboxes. Then log in as the service account.” I advised the network administrator to create a service account for me. Uplon creating the account i resumed my work as usual.

Suddenly your manger says to you, man, we just wanted to modify the core search results of the SharePoint 2010. So the first step is to add a Search core results web part to your search results page and open the same page in a browser. After that put the page in edit mode and choose edit web part from the Search Core Results Web Part menu.

In the Search Core Results Tool Pane open the Display Properties section and then uncheck “Use Location Visualization” and you can notice that the XSL Editor… button should become active.

Click the “XSL Editor…” button to open the Text Editor dialog.

Replace all the above XSL with the below (or just copy to the clipboard hence you will need the data in future):

When you wanted to modify the search results, then what you have to do is to modify the XSLT part that we copied in one of the steps above. I usually used to do is to copy all those XSLT in to Visual Studio and then modifying the same as needed.

By default the search results would be as below with icons, etc.

After modifying the XSLT the search results would like below:

I was using the OOB search paging web part to get the paging for the search results.

Glad I got some few minutes to update my blog after 2 months hence was in a busy schedule. J Please refer the below code for you to create a Publishing page on Sharepoint 2010 based on a page layout which is available in your site.

IF anyone interested in doing the branding the top navigation of the sharepoint site, just start it with this link.

before branding the Top Navigation:

After branding the Top Navigation:

The above mentioned SharePoint top navigation had to support variation with the Arabic fonts. So i had issues when the top navigation turns its direction to RTL. so the solution mentioned in the below link helped me out to find the problem which made the menu to behave naughty.

apart from the branding of the top navigation had to brand the search OOB webpart. You can find the style which i used in the below css style.

before branding the search OOB webpart:

after branding the search OOB webpart:

As well as if you need to hide the breadscrumb (sitemap path navigation) of the site please add the following entry in the master page or in a content editor web part on the page. (just check the ID of the control when browsing the page).

I was restoring a SharePoint backup which i took it from one of our staging servers to the virtual machine in my local machine. So was unable to restore the same and was getting the following error due to imcompatible versions in between the Servers (sharepoint foundation versions).

Restore-SPSite : Your backup is from a different version of Microsoft SharePoint Foundation and cannot be restored to a server running the current version. The backup file should be restored to a server with version ‘14.0.0.6106’ or later.
At line:1 char:15 + Restore-SPSite <<<< http://smssps:3333/ -Path ?C:\AppDev-01 backups 28 Nov 2012\ShounAlQuran\ShounalQuranAppDev01.bak” -Force -DatabaseServer “smssps” -DatabaseName “WSS_Content_ShounAlQuran”
+ CategoryInfo : InvalidData: (Microsoft.Share…dletRestoreSite:
SPCmdletRestoreSite) [Restore-SPSite], SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite

use the powershell command : (get-spfarm).BuildVersion to find the version of the sharepoint foundation.

so if the versions differs please go through the following link and install the correct patches to make sure that the versions are same in both the source and the destination.

Shortly, after publishing of the website which i was working on few days back, yesterday i noticed some unexpected number of records is being inserted into one of the Share Point List we do have in our system. The purpose of the said list was to get the user comments from the website visitors for the News, Articles, etc via a User Input Form. The said form was fully secured with the client side scripts for malicious data inputs. At first i panicked, because i was worried about the rest of the user input forms also been compromised. But, thankfully its not and the intrusion was limited only to the said form above. 🙂

When investigated the data that hacker tried to inject into the system seems an automated script which is being used for SQL Injection and as well as a sort of a DOS (Denial of Service) attack. As an urgent fix for this had to implement the Captcha (Completely Automated Public Turing test to tell Computers and Humans Apart) feature to make sure the data is being inputted by a human and not from an automated robotic program.

the interesting part of the above web part is that the markers used to fly in to the locations based on the category. you can refer the following out of the box source code below with zero customization:

I was in a situation where i had to load a share point page into SPDialog (SP.UI.ModalDialog.showModalDialog) after removing the unwanted tags like header, footer, the ribbon, etc. (just need to add the class=”s4-notdlg” for the tags you are expecting not to be included in the dialog).

So in that case you will be in a situation where you may need to remove the background of the dialog which automatically inherits from the parent, etc in other words you may have to load a new CSS when the dialog window opens. Please follow the steps as below to load a CSS file on the fly.

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Finally the projects that we were working was over (not 100%) and had to deploy the site that we were developing on client site. We did some test deployments in our virtual servers using the SharePoint Content Deployment Wizard and everything was working fine. When we started deploying the site on client site using the Share Point Content Deployment Wizard it didn’t allow us to deploy the site. When it starts to deploy its getting crashed or hanged. We tried many ways to get this thing work and finally it didn’t work at all.

When investigated finally we got to know it was due to the SharePoint version. In other words the exported site from our staging environment and the SharePoint version which was installed in live environment on client site was different.

Finally we had to deploy the site by moving the content database of the sharepont site from the staging to live enviornment. woowww!! without any issue it worked fine. 🙂

you can find more details about moving a content database from this link.

Assume that there is a situation where you have to expose only the user defined fields from a sharepoint list by filling up a dropdown. Usually when you tried to get fields collection list from a sharepoint list or a document library you will get list of columns roughly which will include around 40+ columns.

Following code snippet explains you how to populate a drop down list only with the fields that you have created.

Today i was working with a sharepoint visual webpart and was trying to add some data in to session and was getting the error : {System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
at System.Web.UI.Page.get_Session()
at inc_coe_forms.ContactUs.ContactUsUserControl.btnAddMoreFiles_Click(Object sender, EventArgs e)}

Or

Unexpected error occurred: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.
Solution

Usually Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.

I was unable to start the Windows Event Log service on Local Computer. When i tried to start the windows event log service was getting “Windows could not start the Windows Event Log service on Local Computer. Error 4201: The instance name passed was not recognized as valid by a WMI data provider.”

This happened at the time of installing MOSS 2007 in my Windows Server 2008 R2 Server machine. Totally i was gone mad coz MOSS 2007 uninstallation crashes due to some reason and was unable to find out the error due to Eventlog crash (what a hell).

Finally figured it out it was due to some permission problem and i had to apply the SYSTEM user with full control on the folder c:\windows\system32\logfiles\wmi\RTbackup. This solved my problem and the lovely event log was working fine as usual.

Another alternative way is there to renaming the RTBackup file. I didnt try that method hence i have to start the machine in safe mode. It will be a headache at all. so for anyone needs to know about that solution please refer this link.

The below code snippet describes the way to insert user profile data into the SharePoint user profile store. At the time of running the code i came across the above said error. I was googling nearly for 1 1/2 days to figure out the problem. I was trying so many options to solve this problem and nothing worked fine. So finally figured it out its due to some permission problem with the application pool. The application pool identity account should be a domain administrator account which has full access (in other words it should be the same identity like the identity account of the MOSS application pool). details

that account should have following permissions:

The account should be a server farm administrator.

The account has permissions to access the content database.

The account is a site collection administrator.

The account should have permission to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates.

by the way when i was reading through some of other blogs they have mentioned its due to 32/64 bit version. i tried that solution too and it didn’t work for me. you can read more about this via this link.

before installing the Arabic Language pack make sure that you have installed the Microsoft Office Project Server 2007. Once its done as the next step double check whether is that your Windows 2003 Arabic language support. If not follow the steps :

Install additional language files :

Click Start, point to Settings and then Control Panel, and then click Regional and Language Options.

In the Regional and Language Options dialog box, 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

Click OK in the dialog box that alerts you that additional disk space is required for the files.

when i was creating a Records Center in MOSS 2007, suddenly i had to encount for an error :

03/11/2009 10:44:59.45 w3wp.exe (0x0D44) 0x0D3C Windows SharePoint Services Topology 8dyu High The SPPersistedObject, PolicyConfigService Name=PolicyConfigService Parent=SPFarm Name=SharePoint_Config, could not be updated because the current user is not a Farm Administrator.

so the workaround for this error is :

Select you Web Site under Application Pools

Right click => select properties

Go to Identity tab and change the User Credentials to the same credentials that is being used to login to the Sharepoint Central Administration site.

If we need to debug a WebPart which is being integrated into Sharepoint Website then have to modify the existing values in web.config as below :

<customErrors mode=“Off” />

<compilation batch=”false” debug=”true“>

Once the web.config is updated then you can directly set a breakpoint in your webpart source code and can debug in a Visual Studio environment.

1. Open your web part solution in VS 2008 2. Open Moss site or Web part page in a IE (Web Browser) 3. Place a Breakpoint in your code 4. Select Attach to Process from the DEBUG menu from the VS. 5. From the available process list select “w3wp.exe” & click on attached button.

if you prompted for an error “This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name.” at the time of deploying a custom web part or any component in sharepoint as the solution you have to do this :

See if the feature (webpart, lists, etc) that you’re trying to add still exists in the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES” path. if its then remove and try to deploy it again.

through out past few weeks I had a chance to explore the features of the Microsoft Share Point Server. So i m planning to keep all of you guys updated with the stuffs that i did explore in a detailed form when time permits.