Posts Tagged ‘SharePoint’

I was designing a content page based on a page layout in a publishing site.

Usually I won’t direct users to the NewItem.aspx page or the List or Library directly. The way I provide them to create a new item in my current project is usually by customizing the list from with InfoPath and then using an InfoPath form web part in a publishing page. To be honest that’s an interesting and cool way and I’m happy with that. I do like the publishing feature of SharePoint !!!

However what if you like to open a NewItem form as a dialog directly from a content page. I found some articles like this and a good one here and thanks Baris Bikmaz about the post. You can read them for more information. Here is the summary for my case:

I used a HTML web part and customize the code like this.

<a href="javascript:NewItem2(null, '/<strong>YourSiteAddress</strong>/_layouts/listform.aspx?PageType=8&amp;ListId={<strong>YourListID</strong>}&amp;RootFolder=')">
<img alt="" src="Simple Image Address Which I used Instead of a Text Link" />
</a>

Page type 8 means New form Dialog.

Image tag is optional and you can use a simple text instead.

The good thing about this was that when I customized the list new item form with InfoPath, I wasn’t sure if it would open customized or not. and after testing It worked ! the dialog not only opened but also was based on customized infoPath ! Great! šŸ™‚

Advertisements

Yesterday we needed to have full screen background on our SharePoint sites and their pages. After lots of searching and testing different approaches, I found the following solution which is based on jQuery, the most suitable one for us. We couldn’t use the CSS 3 techniques since in my opinion using CSS3 in SharePoint 2010 is not recommended and has a lot of side effects. especially for internal use like Intranet and portal which main objectives are collaboration. I have previously published a post here about CSS3 and SharePoint 2010 which usually case some parts like ribbon or etc start function correctly.

I found my solution here but I changed it a little. Instead of using “$(window).load” , I used “$(document).ready” , so it will help that the image to be re-sized much sooner. According to this blog, if you want to hookup your events for certain elements before the window loads, then $(document).ready is the right place.

Here is the summary of my solution:

  • Needed styles to be attached to the master page:

#bg {
position: fixed;
top: 45px; /* image to start after ribbon */
left: 0;
z-index:-9999
}
.bgwidth {
width: 100%;
}
.bgheight{
height: 100%;
}
  • Needed jQuery (Don’t forget to link to a proper jQuery library!):

$(document).ready(function() {

var theWindow = $(window),
    $bg = $("#bg"),
    aspectRatio = $bg.width() / $bg.height();

function resizeBg() {

if ( (theWindow.width() / theWindow.height()) < aspectRatio )
   {
    $bg
    .removeClass()
    .addClass('bgheight');
   }
   else
   {
    $bg
    .removeClass()
    .addClass('bgwidth');
   }
}
theWindow.resize(resizeBg).trigger("resize");
});

  • Also this tag should be added right after “<div id=”s4-bodyContainer”>” tag in the master page

<img src="../PublishingImages/Background.jpg" id="bg" alt="">

src” is the relative address of the background file for each site. so you can place your background file there.

Good luck ! šŸ™‚

Actually I came up with a request to disable the scroll bar for the site welcome page which was using the custom master page and had a full screen slider. but there were no need to scroll bars on the first page.

Just to mention, I had created the page using SharePoint designer (Right click on master page > new from master page) because it had it’s own scripts and not specific SharePoint content ( you know it was a Welcome page šŸ˜‰ ) for example the page had the ribbon because it was created by a master page. after I put the scripts I found that the SharePoint fake scroll bars is visible however the page didn’t need to scroll at all and scrollbars make the page obscene.

So here I found the solution written by Stephan and in my case to customize and summarize it:

  1. In your master page and body tag, remove scroll=”No”
  2. add the following CSS styles to the page. Either using a CSS file or add styles inside the page.
body #s4-workspace{
    overflow: inherit !important;
}

Last week at the end of the year and last daysĀ (Ā Norouz is comingĀ ! šŸ™‚ ) I was challenging with this error when I was trying to open office docs in Microsoft web apps.

“Word Web App cannot open this document for viewing because of an unexpected error.Ā  To view this document, open it in Microsoft Word”

 

Finally I configured it successfully and to cutĀ a long story short,Ā the important things I did was:

  1. In Central Administration In the “Manage services on server” check the related services are “started”
  2. I created a separate service account ( I did not useĀ the Farm Admin account | System Account ) for the application pools. ( used in service applications )
  3. I found the serviceĀ account MUST have privilege on Content Database. I used DB_Owner role.
  4. Add the service account to the local policy “Replace a process level token”. to do this:
    • On the Windows 2008 server, select Start | Programs | Administrative Tools | Local Security Policy
    • Expand Local Policies | User Rights Assignment
    • In User Rights Assignment | Click on the Replace a process level token policy. Click on Add user or group. Type in the service account, resolve the name. Click OK. Click OK. Click apply. Click OK. (Below is a screenshot of the policy)
    • After the permission is set then launch a command prompt and type the following: gpupdate /force
  5. you also may need an IISResetĀ /noforce

After doing this Web Apps should work correctly. you can also check this link and this one. I found them useful during my search for the problem and solution.

good luck šŸ˜‰ !

 

In Sharepoint 2007 when you want to create or extend a web application or create the central administration site ( after installing ) you know that one step is to choose authnetication type. I read a good point about one of the differences between these two types and want to share it with you šŸ™‚

  • NTLM is the default authentication type. it authenticates each user request against the domain controller. This increases the traffic to the domain controller because each user request needs to be authenticated. Therefore, NTLM authentication impacts the performance of WSS.
  • If the network domain in your organization supports Kerberos, you should use Kerberos because it stores user credentials on the WSS server. As a result, the performance of WSS improves because the WSS server does not need to authenticate each user against the doamin controller.

Today morning , my manager called me and said to me that our sharepoint site has stopped working and for all users it gives “Server Error in ‘/’ Application”.

I came to the company and check all services , IIS and database. There were working without antproblem. it was strange !

So I decided toĀ  change the web.config file to to see more details. as I said before IĀ  changed “CustomErrors” and “CallStack” attributes in web.config . I found that this is a new error and it’s about parse.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Data at the root level is invalid. Line 1, position 1.

Source Error:

Line 1:  <browsers>
Line 2:      <browser id="Safari2" parentID="Safari1Plus">
Line 3:          <controlAdapters>

Source File: /App_Browsers/compat.browser Line: 1

Solved ! after a little search I found when you modify a file with MS Sharepoint Designer, It creates a folder with name _vti_cnf in App_Browsers that another compat.browser is in it.Ā  So after deleting the folder our site started to work fine again. It seems that the best application to open these files i Visual Studio or Virual Web Designer not MS Sharepoint Designer.

Now ItĀ is at least 2 weeks that IĀ found 2 kind of errors in my sharepoint server Event Viewer. yes, I solved them finally !! šŸ™‚

The first one was :

Source : Office Sharepoint Server
Category : Office Server General
Event ID : 7888
Description :
A runtime exception was detected. Details follow.

Message: Cannot open database “DB Name” requested by the login. The login failed.
Login failed for user ‘NT AUTHORITY\SYSTEM’.

The Second one :

Source : Windows Sharepoint Services 3
Category : Database
Event ID : 3760
Description :
SQL Database ‘DB Name’ on SQL Server instance ‘Server Instance’ not found. Additional error information from SQL Server is included below.
Cannot open database “DB Name” requested by the login. The login failed.
Login failed for user ‘NT AUTHORITY\SYSTEM’.

The point was that I had deleted these databses before. There were some old sharepoint Ā RESTORE databases.Ā These databasesĀ did not exist any more. I wondered a lot why sharepoint OWSTIMER attempt to connect to them.Ā I searched a lot and finally found it is related to my content databases. yes, I thinkĀ any Restore database, will add to the related web application as a content database.

However I had deleted the old databases manually from the SQL server management Studio, but the name of databases had remained in the Central Administration. I found them in the Application Management > Content Databases . So after CheckedĀ the Remove content database and push OK , there were no more errors in the event viewer.
I think we for deleting any content content database, it’s better to use this way instead of manually deleting it from SQL management studio.

Good luck !