Tuesday, December 22, 2009

Programmatically Deleting versions from a Sharepoint Document library

Some programming tasks are straight forward with SharePoint API. But, some times, you gotta be tricky.
There is a trick to delete the versions from a SharePoint document library.
each time a version is deleted from the document library, item index will be changed. So, the version item collection gets flushed for each and every delete. To deal with this item Index change, we need to itereate through all the folders and files and make sure to delete the first indexed file always(file.Versions[0].Delete()). This makes sure that the lowest indexed item will be deleted for each and every index flush.


SPSite site = new SPSite("http://servername/sites/sitecollname");
SPWeb web = site.OpenWeb();  
web.AllowUnsafeUpdates = true;
SPDocumentLibrary docLib=(SPDocumentLibrary)web.Lists["Documents"];
foreach (SPListItem folder in docLib.Folders)
  {
     for (int i = 0; i < folder.Folder.Files.Count; i++)
         {

SPFile file = folder.Folder.Files[i];
int counter = file.Versions.Count;

for (int j = 0; j < counter; j++)
{
if (file.Versions[0] != null)
{
file.Versions[0].Delete();
}

}
}

}
web.Update();
web.AllowUnsafeUpdates = false;

Friday, December 18, 2009

Display name synchromization with the AD changes

Problem:
Sharepoint user display name doesnot change with the AD changes.
Fix:
Check the status of the sync:
STSADM -o sync -listolddatabases 0
check the timestamp that shows the sync. If not in sync follow the below.
  1. Go to SCA -> SSP-> User Profiles and My Sites -> User profiles and properties
  2. Start the full import to synchronize the chagnes in the AD or to remove the un wanted profiles. To update the Profile info with the new changes in the AD, just go for the incremental update.
  3. Click on the import source or import schedule link to get the Configure Profile Import page.
  4. Click on the "Refresh" to affact the changes.

Wednesday, October 7, 2009

Sharepoint User Profiles And Properties - Access denied

Problem definition:

Even though you are the farm administrator, site collection admin for the ssp, you get access denied error, when you click on the 'User profiles and properties'.
Sharepoint Central Admin -> SharedServices1 -> User Profiles and My Sites -> User profiles and properties'

Fix:

  1. Go to Personalization services permissions link located under the User Profiles and My Sites section on the shared services1 page.
    Sharepoint Central Admin -> SharedServices1 -> User Profiles and My Sites -> Personalization services permissions
  2. Add users/group. Add yourself with the manage user profiles permissions.
    If you are the admin then add the user who complained about the access.

Tuesday, September 29, 2009

SharePoint logs issue : Monitorable Tracing Service lost trace events

Problem:
Some times SharePoint logs show some weird junk lines like:
"wsstracing.exe (0x0984) 0x1728 ULS Logging Unified Logging Service uls1 Monitorable Tracing Service lost trace events.Current value 230. "

Fix:
1. Restart the WSS Tracing service.
start-> programs -> administrative tools -> services -> Windows Sharepoint services Tracing service.

2. Restart the Windows Administration service Adminsitrtion service also.

Monday, September 28, 2009

Event log error 5555

Problem:

Failure trying to synch web application xyz, ContentDB xyz Exception message was A duplicate site ID xyz (http://xyz.com) was found. This might be caused by restoring a content database from one server farm into a different server farm without first removing the original database and then running stsadm -o preparetomove. If this is the cause, the stsadm -o preparetomove command can be used with the -OldContentDB command line option to resolve this issue.

Reason:

The above error due to the reason that the table “sistesynch” in the db. Usually the profile synchronizations service runs once in an hour. Database id‘s in this table “sistesynch” do not match with the database id’s from the config database. There will not be any problem with the Site ID’s.

Fix:


Whenever you attach/detach the content database, this table has to be updated. If you delete the rows in this table manually, this error goes away and the table will be auto filled back with correct sites and database id’s next time when the service runs i.e an hour.

If you cant delete the table row entries manually(access restriction) , you can do the same operation using the following stsadm command.

stsadm -o sync -DeleteOldDatabases 0

Once you execute this command, it will list all the deleted rows and after that table “sistesynch” will be auto populated.


Note: perform the above command each time you attach/detach the content databases. Best practice is to script this command along with the actual routines

Wednesday, June 3, 2009

Dealing with Sharepoint Orphans

Orphans are the objects in a SharePoint schema that live without a parent or child relationship in the database. The entries that made in the config DB are incomplete or missing some thing.
Reasons for the Orphans creation:

  1. Usually orphans get createed while migrating the sites from SPS 2003 to MOSS.
  2. User creating the site, doesnt have enough permissions on the DB.
  3. User closing the site creation module abruptly.

Symptoms:
Usually, orphaned sites will not be available to view from the browser. In some cases I saw some orphaned sites that look fine from the browser, but breakes the lists and sub sites eventually.
There is no UI module in the CA or any site settins page available to detect an orphan. Orphans can only be detected through SQL or below STSADM command.

stsadm -o databaserepair -url -databasename [-deletecorruption]

The above STSADM command is for MOSS orphans that exist in the configDB.
Use the below SPSADM command to remove the orphans in the SPS 2003.

spsadm repairorphans portalURI.

Some orphans are very adamant and needs the manual removal. Below is the explaination and fix for each kind of orphan.

Types or orphans:
1. Configuration Orphans: These orphans are very easy to deal with, as these orphans could only mess up your configuration DB. Possibly, they do not have a content DB entry for a child. Detaching the corrputed content database from your farm and reattach it would fix the issue. This is a kind of config DB flush that would refresh the sitelist that is tied to that content database and removes the wrong entry automatically.
2 . Content Database Orphans: These are bit complex to deal with.
There are 2 essential types of content database orphans.

Type 1 Scenario(reactive maintenance):

Site content is is available in the farm's content database but not mapped to the proper configuration . In this kind of scenario, a blank new site is mapped to the configuration database.
So, the symptom is, whenever you access a site you always endup viewing a blank site.
Fix:
> Backup the orphaned site .
> Delete the orphaned site.
> Detach and reattach the database that contains the site's content.
This fix will edit/remap the site to the configuration database.
Type 2 Scenario(Planned Maintenance):

Site mapping is good, all the sites are rendered properly. But you see orphans in a content database or other databases.
Fix:
Backup your production site and delete it. Once that completes detach and attach the database that contains orphan, this will in effect map the orphan to the configuration database and render it accessible. You can then delete it using STSADM. Perform these steps until you have cleaned all orphans. Once all orphans are clean you can then restore your production site back into the farm.

The above fixes are good for any terrific orphans legally. When I say legally, by the means of following the Microsoft's headsup. As an extra information, I experimented on deleting the site intries and re-mapping in a very low level( by deleting the entries from the SQL server directly). THIS IS NOT RECOMMENDED UNLESS YOU ARE AN EXPERT. PLAN FOR THE FARM BACKUP OR DISASTER RECOVERY BEFORE PERFORMING BELOW OPERATIONS.

  1. Run the below command:
    stsadm -o databaserepair -url -databasename [-deletecorruption]
  2. Get the XML out put and note down the corrupted site ID and all the corrupted List IDs
    To double check whether its a valid ID, go to the 'webs' table and check.
    Script:
    select * from webs where id = 'SITEIDABCD-ABCD.....'
    select * from aptb_lists where tp_id = 'LISTIDABCD-ABCD...'
  3. To Delete a orphaned LIST or DOC LIB entry in the content DB, follow the script:
    delete from aptb_lists where tp_id = 'Orphan list ID'
    delete from docs where tp_id = 'Orphan list ID'
    delete from Userdata where tp_id = 'Orphan list ID'
  4. To delete a site entry manually follow below scripts
    delete from webgroupmembership where webid= ‘LISTID'
    delete from webmembers where webid= ‘LISTID'
    delete from webs where id = 'LISTID'

Avoiding Orphans:

Some times, when you try to create a site collection from the central admin or stsadm, the site collection creation process takes several minutes. If you dont have the patience or skeptic that the creation wizard got hanged, then human tendency will try to close/back the window. But actually behind the screens, sharepoint was done with the site collection creatin part for some extent. At this time if the site collection creation process is paused or stopped by the admin, sharepoint leave the site as an orphan. Remind users that creating and deleting a site can be a sometimes several minute process. Regardless of how long it takes let the application itfinish what is doing. If it times out then try again but never click back, stop, or close the window when performing these types of administration tasks. Network Latency, Web front end performance and SQL backend performance can all attribute to a slow create or delete statement. Be patient .

More about the Orphans:
http://blogs.technet.com/corybu/archive/2007/05/31/sharepoint-orphans-explained.aspx

http://www.songhaysystem.com/kb/number/2076072084/subject/winos

Wednesday, April 8, 2009

How to Set New Ringtones For Your iPhone

Apple charges you $2 per song in order to set it a song a ring tone.

Below is the procedure to add a song for free and legal. All that's involved is a little bit of tinkering. For those of us who use Windows and Mac as Operating Systems, it will work perfectly fine. Now, all you need to get started is an iPhone itunes software, and a PC that uses Mac or Windows as an operating system.

  1. Open the iTunes Player.
  2. Add the song from the hard disk (File -> Add File to Library) From the library -> music, select and pick the song that you want as a ring tone. If you wanna choose the part of the song, right click on the song, and select the option get info -> select the tab 'Options'. From there, just type the start time of the ring tone in the box right after start time. This should be in the format minute: second. For example, 3:34. Similarly, repeat the exercise for stop time as well.To make a ring tone of about 40 seconds is advisable. Clon the OK button. Now go to the song again and select the option that converts the current selected media into AAC format. This will take a few minutes. A duplicate version will be created. Now right click on the ring tone again and delete it. Next, click on the keep files button. Now, search the file that you just created. It will most probably be located in the iTunes folder. The file format would be .m4a. Now, from the Tools Folder Options, you need to change the file format from .m4a to .m4r.

A simple double click, when done slowly, would also do it though. Another method is to rename the file in case of Windows, and get info for those who use Mac OS. The system will automatically warn you about the change in the file format. You can choose to ignore that. Now, double-click on the newly created ring tone file. The iTunes player will add the particular media in the ring tones category in the iTunes library. Now, just connect the iPhone and sync that ring tone.

Not only does it save you a buck or two, it saves time and gives you your whole music collection to choose from!

Friday, March 20, 2009

Hiding the List Menu options (Views, context menu items)

Wrap up the following Javascript code into the content editor webpart!
-----------------------------------------------------------------------

hideListViewToolbarItems("Edit in Datasheet", "export to Spreadsheet",
"view rss feed","settings:create view");
function hideListViewToolbarItems()
{
var menuItem;
var menuItemName;
var menuItemIndex=-1;
var menuItemNames=new Array("edit in datasheet",
"open with windows explorer",
"connect to outlook",'export to spreadsheet','view rss feed','alert me'
,"create column","settings:create view","list settings",
"document library settings","explorer view","all documents",
"all items","modify this view",
"view:create view","new document",
"new item","new folder","upload document",
"upload multiple documents");
var menuItems = new Array("EditInGridButton",
"OpenInExplorer","OfflineButton",
"ExportToSpreadsheet","ViewRSS",
"SubscribeButton","AddColumn",
"AddView","ListSettings","ListSettings",
"View1","DefaultView",
"DefaultView","ModifyView","CreateView",
"New0","New0",
"NewFolder","Upload","MultipleUpload");
var allMenuItems = document.getElementsByTagName('ie:menuitem');
for(var i = 0; i < hideListViewToolbarItems.arguments.length; i++ )
{
menuItemName= hideListViewToolbarItems.arguments[i].toLowerCase();
for (j=0; j < menuItemNames.length; j++)
{
if(menuItemNames[j]==menuItemName)
{
menuItemIndex = j;
break;
}
}
menuItem=menuItems[menuItemIndex];

for (var l = 0; l < allMenuItems.length; l++)
{
if(menuItemName.indexOf(":")!=-1)
{
menuItemName = menuItemName.split(":")[1];
}
if (allMenuItems[l].id.indexOf(menuItem)!=-1
&& allMenuItems[l].text.toLowerCase() == menuItemName)
{
// For FireFox Compatibility
var parentNodeOfMenuItem = allMenuItems[l].parentNode;
parentNodeOfMenuItem.removeChild(allMenuItems[l]);
break;
}
}
}
}

Ref: Ayman's blogspot

Monday, March 16, 2009

insufficient memory to continue the execution of the program

While clicking on the 'Search settings' page, you get the following error:
'insufficient memory to continue the execution of the program'
Fix:
  1. Perform the below steps on every WFE in the farm:
    net stop WSSTimerV3
    net start WSSTimerV3
  2. If you are not through the first step, kill the MS Search.exe on each WFE
    Task Manager -> Processes -> MSSearch.exe -> right click -> end the process
    (If you cant see the process in the list, check the 'show processes from all users')
  3. Try flushing the local mso config cache to avoid this error throwing often.

Tuesday, March 3, 2009

Javascript Error while editing the Content Editor Webpart

This error is due to the JavaScript plug-ins (HtmlEditor.js or BFORM.js) files in the 1033 folder on the 12 hive. When you add the SP1, it did not update these two files to compliance with .js codes in 'content editor' web parts. These kind of issues occur when you miss the installation sequence, i.e. SP1 was added after the java script plug-ins. Thus, unable to control the files later.

Steps to recover:
  1. If you have more than one severs running in the form, go to the server in the form, where the Content editor popups are working fine.
  2. Go to: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
  3. Replace the HtmlEditor.js , BFORM.js and OWS.js with the healthy server's files.

While trying to edit(edit->modify shared webpart-> rich text editor) a Content Editor Webpart, Rich text editor window will popup.
Due to the popup blocker flags on the browsers, this popup window will be blocked. To avoid this, Microsoft added the fix within the servive packs that will go and edit the javascript plug-ins on the MOSS 2007 . This update goes with the installation of the WSS SP1.

Friday, February 27, 2009

PDF files search in sharepoint!

Hidden truth is, Sharepoint doesn't have any of its own search mechanisms. Its just a postman between the client and the database server, where all the sharepoint content is stored. Sharepoint server takes the request string and builds a query to be passed to the SQL server. Upon the query, SQl server passes the string to its own engine! File indexing is maintained on the Index server.

By default, SharePoint only searches the .txt, .htm, .doc, .xls, and .ppt. Coz, SQL Server can crawl through the base file extensions. PDF is a Binary file type can't really be searched with the SQL full text search engine, as it cant understand the format of PDF. So, Adobe came out with its own free filters.
Adobe 5.0 iFilter Download
Adobe 6.0 iFilter Download
You need to follow the installation procedure on the down load page and install the iFilter on the INDEX server.

PDF Docuement Full Text Search:

If you not install the iFilter on the Index server, PDF files will be shown in the search reasults matching the title name only. But, text inside the PDF file is not indexed and not shown in the search resutls. Inorder to index the content inside a PDF docuement(Full Text Search), you need to apply the iFilter on the Index server.

After the full crawl, new uploaded files that are uploaded before the Full Crawl and after the iFilter install are full text indexed automatically. But, some times the files which are uploaded before the IFilter was installed cannot be added to the full text indexing automatically. We need force the full text indexing on these old files by disabling full text indexing and enabling it again in central administration. If it’s not effected by using Central Admin UI, we can use Query Analyzer to force a rebuild, like..

USE WSS Content DB Name
EXEC sp_fulltext_catalog 'STS_servername', 'rebuild'

PDF Icon display:

By default PDF files are shown with an Internet explorer icon in the serach results. Follow the below procedure to associate an icon to the search results(Note: Even though you install iFilter on Index server, this PDF icon procedure has to be followed on each and every front end serer in the SharePoint server farm. i.e All web servers and Index serer)

  1. Go to Adobe site and copy paste the PDF icon(PDFicon.gif) in the below folder.
    drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES
  2. Edit the document mapping XML file(Docicon.xml)
    Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml\Docicon.xml
  3. Add the below line under the ByExtension node.
    <Mapping Key="pdf" Value="pdfimage.gif"/>
  4. Recycle the search service:
    Run->cmd iisresetnet stop osearchnet start osearch

For 64-bit windows, you need to download the iFilter seperately. iFilter that comes along with the Adobe V8 installation supports only the 32-bit OS.

SQL Server's search engine deals with the base types and with the addition of new iFilters, it can go right with the associated formats. Microsoft comes out with a free iFilter for RTF. Other available IFilters for PDF, RTF, MSG, ZIP are fount at IFilterShop.

Additional procedure for Adobe v8 iFilter:

Adobe v8 comes along with the iFilter. So, no need to install a iFilter for Adobe V8 on a 32- bit windows. This applies to the 64-bit windows:

  1. Add the filter-extension to the File types crawled:
    Start -> Program -> Microsoft Office Server -> SharePoint 3.0 Central Administration -> Search Settings -> File Types -> New File Type (Add extension pdf here)
  2. Modify the following Registry keys by changing their "Default" value to the new CLSID of the Adobe IFilter: {E8978DA6-047F-4E3D-9C78-CDBE46041603} HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdfDefault -> {E8978DA6-047F-4E3D-9C78-CDBE46041603} HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdfDefault -> {E8978DA6-047F-4E3D-9C78-CDBE46041603}
  3. Add the Installation directory of the Adobe Reader v.8 to the System Path. For example, if the Reader is installed on "C:\Program Files\Adobe", then add"C:\Program Files\Adobe\Reader 8.0\Reader"or"C:\Program Files\Adobe\Reader 9.0\Reader" to the system path by: Right Click on My Computer -> Properties -> Advanced -> Environment Variables -> Path (Under System Variables) -> Edit -> (Add "C:\Program Files\Adobe\Reader 8.0\Reader"). This effectively tells the adobe IFilter where to pick up the dependent DLLs.
  4. Copy the .gif file that you want to use for the icon to the following folder on the server:SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images
  5. Edit the DOCICON.xml file to include the .pdf extension. Navigate to SharePoint Server 2007 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml Open the Docicon.xml file. Add an entry for the .pdf extension Save the DOCICON.xml
    Recycle the search service: Run->cmd iisresetnet stop osearchnet start osearch
    Now you can crawl and search PDF documents with v.8 Reader.


Ref: snahta.blogspot.com

Thursday, February 26, 2009

SharePoint Performance

Follow the below things to improve your sharepoint performance

  1. Disable the debug mode by making the "debug" mode is "false" on all web applications
    Web application's web.config -> debug mode "false"
  2. Disable the debug mode at the machine.config.
  3. Have blob cache enabled at the web application's web config file.
    Web application's blob node should be some thing like this:
<BlobCache location=":\blobCache" path="\.(gifjpgpngcssjs)$" maxSize="10" max-age="86400" enabled="true"/>
This will enable the cache file. Al l the files are saved on each and every Web Front 's specified location. By specifying the cache time out , Browser will not rerequest them for about 86400 minutes.

Saturday, February 21, 2009

JavaScript Tabs within the Content Editor Webpart

Copy paste the following code into the 'Source Editor' section in the Content Editor Webpart.
--------------------------------------------------------------------------------
Add the following inside the style node and embed inside the head and html notes. Due to the constraints in the editor can't code exactly.

.ui-tabs-hide{display: none;}ul.ui-tabs-nav{ margin: 0; padding: 8px 0 0 0;}ul.ui-tabs-nav li { list-style: none; margin: 0; display: inline; font-size: 12px;}ul.ui-tabs-nav li a { padding: 5px; margin-right: 3px; border-bottom: none; text-decoration: none; color: #000000; text-transform:uppercase;}ul.ui-tabs-nav li a:hover { color: #000; background: #F1EEE7; text-decoration: none;}.ui-tabs-selected a { background-color: #F1EEE7!important; }ul.ui-tabs-nav li.ui-tabs-unselect a { background-color: #F1EEE7;}ul.ui-tabs-nav li.ui-tabs-unselect a:hover { color: #333; background-color: #F1EEE7;}.ui-tabs-panel { background-color: #F1EEE7; padding: 5px; line-height: 18px;}.ui-tabs-panel ul { margin-left: 0;}.ui-tabs-panel ul li { background-color: #F1EEE7; border-bottom: 1px solid #fff; padding: 5px 0 6px 20px;}

include the following in the body of the hml section after the head section.

div id="topsidebar"
ul class="ui-tabs-nav"
li class="ui-tabs-selected"
a href="#fragment-1

span Office /span /a
/li li class="" a href="#fragment-2" span Email /span /a /li /ul


div id="fragment-1" class="ui-tabs-panel ui-tabs-hide"
p Here are details corresponding to the hotel attendees will be staying at:
/p p a href=http://mcafee.com Office /a br / head quarters drive Plano TX 75050 br /
Tel: 1.111.111.1111Fax: 1-111-111-1111 /p /div div id="fragment-2" class="ui-tabs-panel ui-tabs-hide" p email me p Umakanth Nelige br / a href=mailto:umakanth.nelige@gmail.com Umakanth nelige E-mail/a br /111.111.1111 /p /div /div

download the JQuery files and copy paste in the content editor webparrt.

Friday, February 20, 2009

Silver Light displaying in a content editor webpart

problem:

After uploading the .xap file to the webpart doc lib, and after pointing the xap file with an object tag in the content editor part's source code, you will not see the control.

Reason:
As the tag never understands the X, Y directinal values, it will display over the content editor.
Content Editor webpart was developed to be enclosed to the page's hidden DIV property, thus causing the tag control to fall in the invisible Div.

Work Around:
  • Set a fixed height and width in the web part appearance properties, and give the object tag a height and width of 100%,

    OR
  • Set an absolute height and width for the object tag and leave the web part with non-fixed height and width

Sunday, February 8, 2009

iPhone Allpications fail to run!

Problem:
Last week I went to my friend's place and forgot to take my charger along with me! As I am a iPhone-junkie these days, played the games all night and chatted with my pals until I was kicked by the battery! As a desperate game freak, I connected my iPhone with my friend's PC.
Now, I cant play games anymore, as they never respond!

Technical Reason:
When I connected my iPhone with my friend's PC, my iPhone's Authentication module got bugged. Now the authentication (Id/pwds) for my i-Tunes and applications will not work, as they think that they are on the wrong iPhone!


Work around:
  • Connect your iPhone to your PC
  • Take the backup (Never forget this step any time)
    Devices ->right Click on your Phone name -> backup
  • Un sync the Applications(Games)
    Devices -> Click on the phone name -> in the right hand tabs area, click on the 'Applications' tab -> un check the 'sync applications' -> Apply -> Sync
  • De Authorize the computer to reset the iPhone Authentication to the scratch.
    On the i-Tunes menu -> Store -> Deauthorize Computer -> Enter the ID & password.
  • Authorize the computer to reset the iPhone from scratch to a valid authentication
    On the i-Tunes menu -> Store -> Authorize Computer -> Enter the ID & password.
  • Sync the Applications(Games)
    Devices -> Click on the phone name -> in the right hand tabs area, click on the 'Applications' tab -> Check the 'sync applications' -> Apply ->Sync.

    Now you are back to freaking games ..! Hav Fun ye..!!

Tuesday, January 20, 2009

Image rotator embedding in a content editor webpart.

Place the images in a image library(eg, http://SiteCollName/sites/sitename/doclibname/Image3.JPG")
now, copy paste the below code in the content editor webpart.
<script language="JavaScript">
<!--function adArray()
{for (i=0; i*2<adArray.arguments.length; i++)
{
this[i] = new Object();
this[i].src = adArray.arguments[i*2];
this[i].href = adArray.arguments[i*2+1];}this.length = i;
}

function getAdNum()
{
dat = new Date();
dat = (dat.getTime()+"").charAt(8);
if (dat.length == 1)ad_num = dat%ads.length;
elsead_num = 0;return ad_num;
}
var ads = new adArray("http://google.com/",
"http://SiteCollName/sites/sitename/doclibname/Image2.JPG","http://www.microsoft.com",
"http://SiteCollName/sites/sitename/doclibname/Image3.JPG","http://www.google.com",
"http://SiteCollName/sites/sitename/doclibname/Image4.JPG","http://www.google.com");
var ad_num = getAdNum();
document.write('<div align="center"><A HREF="'+ads[ad_num].href+'" target="_blank"><IMG SRC="'+ads[ad_num].src+'" '+'BORDER=0 name=js_ad></A></div>');
link_num = document.links.length-1;
function rotateSponsor() 
{
  if (document.images) 
  {
   ad_num = (ad_num+1)%ads.length;
   document.js_ad.src = ads[ad_num].src;
   document.links[link_num].href = ads[ad_num].href;
   setTimeout("rotateSponsor()",4000);
}
}
setTimeout("rotateSponsor()",4000);// --></script>



source: http://armsinfragilehands.blogspot.com/2008/10/sharepoint-image-rotator.html

Tuesday, January 13, 2009

change anonymous access settings options disabled

Prob Definition:
Inorder to explain the prob definition, I will walk you through the entire Anonymous access settings froms the scratch.

While setting the Anonymous access to a document library,

  1. You set Anonymous access on the desired IIS website:
    IIS -> Websites -> double click on the desired Website -> Properties -> Directory Security -> check the anonymous access box
  2. You set the anonymous access on the web application level
    SCA -> Application management -> Application Security ->Authentication Providers -> Default -> Check the Anonymous access check box
  3. You set the Anonymous access on the site that you desire
    Site Actions -> Site Settings -> Advanced Permisions -> settings -> Anonymous access
  4. Now when you try to set the Anonymous access on a particular document library/list, you try to go to the document library, -> Settings -> Document library settings -> permissions for this document library -> Settings -> Anonymous access
    You get to see the available option disabled or grayed out.

Reason:

Document library you are trying to set the anonymous access is configured to allow only read access on the doc lib.

Fix:

Trick is with the Advanced settings.

Document library -> Settings -> Doc lib settings -> Adv settings -> Item-level Permissions -> Read Access -> All responses.

Note: Edit Access can be set any thing.
Show results can be set any thing

Sunday, January 4, 2009

Modifying the person.aspx file to filter the display in sharepoint 2007

Person.aspx will use various query strings to load the desired person's profile

accountname User's account name, e.g. (DOMAIN\username)
guid The user's guid in SharePoint
sid The user's sid from Active Directory
preferredname Tries to find a match based on the displayName attribute from Active Directory
user Takes various iterations of display names or usernames and tries to resolve to a user, by redirecting to _layouts/SelectUser.aspx.


Open the Person.aspx to see what controls are being used and concentrate on the ProfileViewer (the control that displays Profile Property values).

<SPSWC:ProfileViewer id="ProfileViewer" ShowBusinessCardIfEmpty="false" runat="server" />


this ProfileViewer is inherited from ProfileUI, the InitControl will have the code:

this.objLoader = ProfilePropertyLoader.FindLoader(this.Page);


this is the method call to get a loaded profile.
Now looking in to the ProfilePropertyLoader, will look for the object. If not found in the HttpContext.Items collection, that will create a new object.

The ProfilePropertyLoader has two properties that return a UserProfile object, ProfileCurrentUser (the profile for the browsing user) and ProfileLoaded (the profile of the user to be displayed, which may be the same as ProfileCurrentUser).


after getting to know the UserProfile object via ProfilePropertyLoader, create a filter web part, so that you could pass in filter or query values from the UserProfile to other web parts via Connections.

MSDN has a great article on creating a Filter provider web part, so follow that and add code to get user profile values and pass those into other web parts.

public ReadOnlyCollection<string> ParameterValues   
 { 
get
{
        // Get a reference to the ProfilePropertyLoader,
         // which contains the reference to the UserProfile 
         Microsoft.SharePoint.Portal.WebControls.ProfilePropertyLoader loader = Microsoft.SharePoint.Portal.WebControls.ProfilePropertyLoader.FindLoader(this.Page);  
        if (loader == null)  
       {  
          return null; 
        } 
       Microsoft.Office.Server.UserProfiles.UserProfile profile = loader.ProfileLoaded; 
  if (profile == null)  
    {  
           return null;  
       }  
       string thirdPartyAppUserID = (string)profile["ThirdPartyAppUserID"].Value; 
        if (string.IsNullOrEmpty(thirdPartyAppUserID))  
        {  
            return null; 
        }  
        List<string> thirdPartyAppUserIDList = new List<string>();  
       thirdPartyAppUserIDList.Add(thirdPartyAppUserID); 
         return new ReadOnlyCollection<string>(thirdPartyAppUserIDList);  
    }   }


source:
http://www.sharepointblogs.com/toth/archive/2008/05/30/filtering-data-on-the-mysite-profile-page-person-aspx.aspx

Friday, January 2, 2009

Context changes in Sharepoint Designer

current user's permission for that item is shown in the 'perm' attribute in SPD code view.
Open SharePoint Designer 2007 and navigate to the page containing the Data Form Web Part. (follow the "Steps to Reproduce" above) In Code view,search for the following peace of code:Perm="{ddwrt:CurrentRights()}" Replace it with the following peace of code:Perm="{@PermMask}" Save the page.

permanent solution:
Go to the folder where SharePoint Designer 2007 is installed. Usually it will be: "c:\Program Files\Microsoft Office\Office12". Find the file CAML2XSL.XSL and open it in a text editor (I used Notepad). Look for the following peace of code (There should be only one occurrence of it) : ddwrt:CurrentRights() Replace it with the following peace of code: @PermMask Save the file