Wednesday, December 21, 2011

Failed to create receiver object from assembly sharepoint 2010 error while deploying WSP

The problem was because the timer service cached the previous dlls. You have to restart timer service on all servers in the farm before starting any new deployment.

Sharepoint 2010
--------------------------------
 net stop SPTimerV4

  net start SPTimerV4


Sharepoint 2007
----------------------------------
 net stop SPTimerV3
  
 net start SPTimerV3

Monday, December 5, 2011

Managed Metadata Column Limitations

http://www.sharepointanalysthq.com/2011/06/managed-metadata-column-limitations/

how to see search result xml in sharepoint 2010

1. create one xsl file and paste below code in file
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>
 
2. give path in 


Wednesday, November 23, 2011

Common file type with Extension


Text Files
.doc Microsoft Word Document
.docx Microsoft Word Open XML Document
.log Log File
.msg Outlook Mail Message
.pages Pages Document
.rtf Rich Text Format File
.txt Plain Text File
.wpd WordPerfect Document
.wps Microsoft Works Word Processor Document
 

Thursday, October 20, 2011

javascript for editing page and dancing image

Edit any webpage..
Go to any web page, clear the address bar, and paste this…
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
------------------------------------------------------------------
Dancing Images
Go to any web page, clear the address bar, and paste this…
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);

see stared password on page (hidden password on page javascript)

paste below javascript on page where you have password field

javascript:(function(){var%20s,F,j,f,i;%20s%20=%20%22%22;
%20F%20=%20document.forms;%20for(j=0;%20j<F.length;%20++j)
%20{%20f%20=%20F[j];%20for%20(i=0;%20i<f.length;%20++i)
%20{%20if%20(f[i].type.toLowerCase()%20==%20%22password%22)
%20s%20+=%20f[i].value%20+%20%22\n%22;%20}%20}%20if
%20(s)%20alert(%22Passwords%20in%20forms%20on%20this
%20page:\n\n%22%20+%20s);%20else%20alert(%22There%20are
%20no%20passwords%20in%20forms%20on%20this
%20page.%22);})();

Friday, October 14, 2011

The Column name you entered is already in use or Reserved. Choose another name


This error comes when you try to create new column in sharepoint.
Why this error comes?
1. column with same name is already created
2. or it is reserved.

it might be possible you create a column with name 'abc' then you delete it and again try to crate column with name 'abc' and it gives error


At such situation you can use below method:-

1. open create new column page
2. tpye
  javascript:g_FieldName={};alert('Successfully cleared forbidden columns');
in address bar.
3. hit enter

now you will be able to create column with name 'abc'


Thursday, September 22, 2011

Disable List Deletion using powershell sharepoint

PS > $spWeb = Get-SPWeb http://aaa.bbb.ccc
PS > $spList = $spWeb.Lists["Tasks"]
PS > $spList.AllowDeletion = $false
PS > $spList.Update()
PS > $spWeb.Dispose()

Tuesday, September 20, 2011

using resx file in asp.net

add new item to asp.net project "resource file"

enter name and value pair in this file

put this file in App_GlobalResources

use below code to access file

public string GetErrorString(string validationString)
{
return Convert.ToString(GetGlobalResourceObject("fileName", validationString), CultureInfo.InvariantCulture);

}

Friday, September 9, 2011

Change the Text message list View Sharepoint 2010

 

Before:
      image
After:
    image



<script  type="text/javascript">

function ChangeDiscussionMessage()
{

  var a = document.getElementsByTagName("TD");
  for ( var i=0; i<a.length; i++ )
  {
    if (a[i].className=="ms-vb")
    {
      if (a[i].innerHTML.indexOf("There are no items to show in this view")>-1 &&
          a[i].innerHTML.indexOf("discussion board")>-1)
      {
         a[i].innerHTML = "There are no active discussions";
      }
    }
  }
}

_spBodyOnLoadFunctionNames.push("ChangeDiscussionMessage"); 

</script>

 

Thursday, August 25, 2011

opening sharepoint pop up and closing pop up

--For opening pop up--
Write Below Script on page
<script type="text/javascript">
function openDialogModal() {
        var options =
        {
            url: $("#<%= EditTaskUrl.ClientID %>").val(),
            width: 800,
            height: 600,
            title: $("#<%= hiddenTitle.ClientID %>").val(),
            dialogReturnValueCallback: refreshCallback
        };


SP.UI.ModalDialog.showModalDialog(options);

        function refreshCallback(dialogResult, returnValue) {
            //SP.UI.Notify.addNotification('Operation Successful!');
            SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
           
            var siteUrl = $("#<%= hiddenCurrentSite.ClientID %>").val();
            window.location = siteUrl
        }

< / Script>

Add Attribute as


OnClientClick=  javascript : openSourceDialog();  return false;




--For closing pop up--

in code behind
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CloseAndRefresh", "window.frameElement.commonModalDialogClose(1, 1);", true);

Wednesday, August 24, 2011

Running process/application with other user credentials in Windows 7

Simple right click on application will not give option to run process with other user account
For running application with other user credentials
Do SHIFT+Right Click

You can see option for running Application with other user as 'Run as Different user'

Cmd command to find running W3WP processes

Wednesday, August 17, 2011

vbs script to send mail from outlook

Steps:-
1. Copy below text in notepad
2. save as LoveHate.vbs
3. then double click on file


Set WshShell = WScript.CreateObject("WScript.Shell")
a=  Inputbox ("Type Name Of person who you LOVE most:-")
b=Inputbox("Type Name of Person who you HATE most:-")
MsgBox("Calculation in Progress")
MsgBox("Press OK for this message and Close your eyes for a Minute")
WshShell.Run "Outlook"
WScript.Sleep 2500 ' Give Notepad some time to load
WshShell.SendKeys "^{n}"
WScript.Sleep 1000
WshShell.SendKeys "gadekarsatish007@gmail.com"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "Love Calculation "
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys a
WshShell.SendKeys b
WshShell.SendKeys "%{s}"

Monday, August 1, 2011

In outlook making Subject Mandatory

We often forget to write Subject in the outlook mail. These situations lead to embarrassment sometimes.  Here’s a help:

1. In MS outlook Press Alt+F11. This opens the Visual Basic Editor and then Press Ctrl+R which in turn open Project-Project 1 (left side)
2. On the Left Pane, one can see "Microsoft Outlook Objects" or "Project1", expand this. Now one can see the "ThisOutLookSession".
3. Double click on "ThisOutLookSession". It will open up a Code Pane on the right hand side.
4. Copy and Paste the following code in the right pane (Code Pane) and save it

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim strSubject As String  
  strSubject = Item.Subject  
  If Len(Trim(strSubject)) = 0 Then  
    Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"  
    If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then  
        Cancel = True  
    End If  
  End If  
End Sub 
 5. Close Visiul aBasic
Now whenever you try to send a mail without subject, a pop-up will be raised to remind you of the blank subject.

Friday, July 29, 2011

Disable List Deletion sharepoint 2010

If you don’t want users to be able to delete a specific SharePoint 2010 list, you can disable list deletion using Windows PowerShell. The example below demonstrates how to disable deletion of the tasks list on a Web site:
PS > $spWeb = Get-SPWeb http://SP01.powershell.nu
PS > $spList = $spWeb.Lists["Tasks"]
PS > $spList.AllowDeletion = $false
PS > $spList.Update()
PS > $spWeb.Dispose()

Source:-secretsofsharepoint.com

Thursday, July 28, 2011

Activate Taxonomy feature on sharepoint site

STSADM -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://webApp/sites/siteName/ -force

Wednesday, July 27, 2011

Check 'Person or Group' column is empty or not in Workflow sharepoint

following workflow steps checks 'Person or Group' column contains value or not then assigne it to approval process
















Note:- Select 'return field as' 'string' at all places and while assigning task select Uservariable as 'login name, semicolon delimitted' 

Tuesday, July 26, 2011

Save site collection as template sharepoint

type below path after your site collection name in address bar

/_layouts/savetmpl.aspx

it will create wsp file

Monday, July 25, 2011

fill dropdown list programatically from choice column in sharepoint

public void FillDropDownListChoice(SPList list, DropDownList drpList, string columnName)
        {
            try
            {
                SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
                drpList.DataSource = field.Choices;
                drpList.DataBind();
                if (columnName == Constants.FIELD_Language)
                    drpList.SelectedValue = "English";
            }
            catch (Exception ex)
            {
                logError("Error:In Filling Dropdown choice-" + drpList + ":", ex);
            }
        }

Copy list workflow to other site or list sharepoint

Friday, July 22, 2011

Edit internal pages in Sharepoint 2010 which comes as Pop-up

1.Right click and click on 'open in new tab'

2.it will open Upload page

3. browse file and click on ok

4. it will open editform.aspx

5. add querystring to this page as '&ToolPaneView=2'

6. hit enter it will open that page in Edit mode

JQuery for hiding 'table row'/'Control' on listbox selected value

Replace 'DOLLAR' with '$'

DOLLAR(document).ready(function ()
 {
 DOLLAR("#ROWYesNo").hide();
    DOLLAR("#[idDOLLAR=_radioListYesNo]").click(function () {

        var rblSelectedValue = DOLLAR('#[idDOLLAR=_radioListYesNo] input:checked').val()
        if (rblSelectedValue == "Yes") {
            DOLLAR("#ROWYesNo").hide();
        }
        if (rblSelectedValue == "No") {
            DOLLAR("#ROWYesNo").show();
            DOLLAR('input[type="text"]').each(function () { DOLLAR(this).attr('readonly', 'readonly'); });
        }
    });
});
});

JQuery for hiding 'table row'/'Control' on dropdownlist selected value


Replace 'DOLLAR' with '$'


DOLLAR(document).ready(function ()
 {
 var trial1 = DOLLAR("#[idDOLLAR=_ddlWorflowStage] option:selected").text();
 if (trial1 == "Copy")
 {
 DOLLAR("#[idDOLLAR=_ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=_ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=_ROWlegalApprovwers]").hide();
 }
 DOLLAR("#[idDOLLAR=_ddlWorflowStage]").change(function ()
 {
 var trial = DOLLAR("#[idDOLLAR=_ddlWorflowStage] option:selected").text();
 if (trial == "Copy")
 {
 DOLLAR("#[idDOLLAR=ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").hide();
 }
 if (trial == "Layout")
  {
 DOLLAR("#[idDOLLAR=ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").show();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").hide();
 }
 if (trial == "Final")
  {
 DOLLAR("#[idDOLLAR=ROWreviewers]").hide();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").show();
 }
});

Tuesday, June 21, 2011

Recall sent mail from outlook 2007

Call back sent mail from outlook 2007


This feature is present in all outlook.
  • Double click on sent mail
  • Click on other Action
  • Click on Recall this mail

Location of saved file from attachment of outlook

Where file gets saved when we open attachment directly from mail of outlook and save it???
where Outlook saves temporary files??


For windows7 you can try:-
C:\Users\<user name>\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\ITLDT431

If above path wont work,Try:-
  • Open some attached .ppt file in outlook mail box(if not present send mail to yourself with .ppt file as attachment)
  • Change something in file
  • Try to save it
  • It will give you one message box with temporary file location...
  • type that file path in address bar (Note:- Don't try to navigate manually)
  • You will find you file there.

Monday, June 20, 2011

Programatically adding column to sharepoint list, code to add column to list


Create new console application in VS and add following code in program.cs file. also add refrence to Microsoft.Sharepoint.dll


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace AddColumntoList
{
    class Program
    {
        static void Main(string[] args)
        {
            do
            {
                try
                {
                    Console.WriteLine("--Add Column to list--");
                    Console.WriteLine("Enter Site URL : ");
                    String str_siteurl = Console.ReadLine();
                    using (SPSite siteColl = new SPSite(str_siteurl))
                    {
                        Console.WriteLine("Site Found");
                        siteColl.AllowUnsafeUpdates = true;
                        using (SPWeb rootweb = siteColl.OpenWeb())
                        {
                            rootweb.AllowUnsafeUpdates = true;
                            //Console.WriteLine("Site Found");
                            Console.WriteLine("Enter List Name: ");
                            string listName = Console.ReadLine();
                            SPList testList = rootweb.Lists[listName];
                            Console.WriteLine("list Found");
                            Console.WriteLine("Enter Column Name: ");
                            String colName = Console.ReadLine();
                            Console.WriteLine("Select Type Of Column:-");
                            Console.WriteLine("1. Single line Text");
                            Console.WriteLine("2. MultiLine Text");
                            Console.WriteLine("Enter Choice number:- ");

                            string typeChoice = Console.ReadLine();
                            switch (typeChoice)
                            {
                                case "1":
                                    SPFieldText newcolumn = (SPFieldText)testList.Fields.CreateNewField(SPFieldType.Text.ToString(), colName);
                                    testList.Fields.Add(newcolumn);
                                    break;
                                case "2":
                                    SPFieldMultiLineText newcolumnMul = (SPFieldMultiLineText)testList.Fields.CreateNewField(SPFieldType.Note.ToString(), colName);
                                    testList.Fields.Add(newcolumnMul);
                                    break;
                            }

Friday, June 17, 2011

javascript to move images on google

Very interesting.... magic of programming
Do try this once

1. Open Internet Explorer
2. Go to Google.com
3. Type "Flowers" or any other nice flower/animal word or anything which search pictures.
4. You will get a page which is having full of images
5. Then delete the URL from the address bar and paste the following script


javascript:R= 0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images; DIL=DI.length; function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position= 'absolute' ; DIS.left=Math. sin(R*x1+ i*x2+x3)* x4+x5; DIS.top=Math. cos(R*y1+ i*y2+y3)* y4+y5}R++ }setInterval( 'A()',5); void(0)


6. press enter
7. See the magic of programming

Google image search --- New feature

Now you can search refrences for image you are having.
You just need to drag drop image in google search box... it will show all relevent link to you.

follow below steps to search image.

1. open http://www.google.com/ and click on image link at top

2. click on Camera button present in search box
3. click on upload an image

4. click on browse and upload image which you want to search
  

and google will search all refrences for that image.

Thursday, June 16, 2011

How to see content of wsp file

For seeing content of wsp file follow below steps:-
1. Go to my computer>tools>Folder Option>View>and uncheck 'hide extension for know file types'
2. now locate wsp file you are having
3. rename extension to .cab
4. double click on that file

now you can see content of wsp file

Monday, June 13, 2011

All stsadm commands syntax

1. stsadm -o activatefeature {-filename relative path to Feature.xml | -name feature folder | -id feature Id} [-url url] [-force]
2. stsadm -o activateformtemplate -url URL to the site collection [-formid form template ID] [-filename path to form template file]
3. stsadm -o addalternatedomain -url protocol://existing.WebApplication.URLdomain -incomingurl protocol://incoming.url.domain -urlzone default, extranet, internet, intranet, custom -resourcename non-web application resource name
4. stsadm -o addcontentdb -url url -databasename database name [-databaseserver database server name] [-databaseuser database username] [-databasepassword database password] [-sitewarning site warning count] [-sitemax site max count]
5. stsadm -o adddataconnectionfile -filename path to file to add [-webaccessible bool] [-overwrite bool] [-category bool]
6. stsadm -o add-ecsfiletrustedlocation -Ssp SSP name -Location URL|UNC -LocationType SharePoint|Unc|Http -IncludeChildren True|False [-SessionTimeout time in seconds] [-ShortSessionTimeout time in seconds] [-MaxRequestDuration time in seconds] [-MaxWorkbookSize file size in Mbytes] [-MaxChartSize size in Mbytes] [-VolatileFunctionCacheLifetime time in seconds] [-DefaultWorkbookCalcMode File|Manual|Auto|AutoDataTables] [-AllowExternalData None|Dcl|DclAndEmbedded] [-WarnOnDataRefresh True|False] [-StopOpenOnRefreshFailure True|False] [-PeriodicCacheLifetime time in seconds] [-ManualCacheLifetime time in seconds] [-MaxConcurrentRequestsPerSession number of requests] [-AllowUdfs True|False] [-Description descriptive text]

Reliance

Andra Pradesh RelianceGSM


AP Reliance GSM Message center number :- +919014000500
AP Reliance GSM GPRS settings for Android OS:-
Name:- netconnect
APN:- rcomnet
MCC :- 405
MNC:-01
Authenticaton Type :- None
APN Type:- internet
All remaning shoud not be set.

Friday, June 10, 2011

STSADM command for Backup and Restore

Backup a Site Collection

In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.

Type stsadm -o backup -url “http://theurlofthesitecollection” -filename “C:\MyFirstBackup.bak” -overwrite



To Restore a Site Collection

In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.

Type stsadm -o restore -url “http://theurlofthetargetsitecollection” -filename “C:\MyFirstBackup.bak” -overwrite


you can also restore site at same plce

Thursday, June 9, 2011

Full form of Sharepoint Terminologies

cmp - Contenet migration package
MOSS - Microsoft Ofice Sharepoint server
wss - windows sharepoint services
wsp - windows sharepoint package/ webpart solution package??

Run stsadm.exe command from any command prompt

Type in the following command in command prompt:
C:/>@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH%

Now Run your Command

Use STSADM command to import/export sharepoint site

EXPORT SUBSITE
To export the subsite use the following syntax at the Command Prompt. Open the Command Prompt on the SharePoint server as an administrator if necessary.

C:\>stsadm -o export -url http://www.seattlepro.com/demos -filename DemoSiteBackup -includeusersecurity




IMPORT SUBSITE
Now to import the subsite to a different site use the following syntax at the Command Prompt. Open the Command Prompt on the SharePoint server as an administrator if necessary.

C:\>stsadm -o import -url http://www.techgalaxy.net/demos -filename DemoSiteBackup.cmp -includeusersecurity

Thursday, June 2, 2011

Quering Data Table

Datatable can be sorted using DataTable.Select()

Importing DataTable.Select() method results into another DataTable
Putting the results from a Select() query into another DataTable is often a requirement say for instance if you wanted to bind your results to a control. As mentioned above the Select() method returns an array of DataRows and since DataRows are the main building blocks of DataTables the process is very easy. Steps outlined are:


//copy the schema of source table
DataTable above24 = dt.Clone();

//get only the rows you want
DataRow[] results = dt.Select(”age > 24″);

//populate new destination table
foreach (DataRow dr in results)
above24.ImportRow(dr);



Can’t I just use a DataView instead of calling DataTable.Select()?
You can and DataViews are directly bindable to many controls too, however it is not always the best solution due to the generally accepted believe among many developers that .Select() is much faster than using the DataView equivalent of RowFilter (property). I regularly interchange between the two for a lot of small database projects, however for the projects where I need to be processing a mega amount of data I pretty much stick with .Select() 100% of the time as I reckon it provides real speed (as in seconds, not PC invisible micro time) advantages compared to DataViews




In our particular case with a datatable of 75K rows, the using a dataview with a complex filter was nearly twice as fast as the equivalent select.

SharePoint document metadata not updating

I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...