Used jQuery


Hi,

I just created few html pages in which for the first time I used jQuery and understood how powerful it is.

This is how page works

It shows three buttons( anchor link with img) and on click of any of the buttons opens up the respective pages as a pop up.

The pop up window on click of any of the buttonsà

(For images, I created rounded rectangular shapes (InsertàShapes) in word and save the doc file as “web page,filtered”)

 

Download the project file from here

http://www.box.net/shared/d7r1ssa3ex

Sample PowerShell Script for creating and deleting WebApplication and SiteCollection in SharePoint 2010


Sample PowerShell Script for creating a web application in SharePoint 2010

# add SharePoint Powershell snapin

add-PSSnapin Microsoft.Sharepoint.powershell

#define variables 

$WebAppName=”SharePoint – 120″

$WebAppPort=120

$WebAppUrl=”http://servername:port/”

$WebAppPool=”SharePoint – 120″

$WebAppPoolAccount=”domain\password”

$WebAppDatabaseServer=”servername\SHAREPOINT”

$WebAppDatabaseName=”WSS_Content_120″ 

new-SPWebApplication -name $WebAppName -url $WebAppUrl -ApplicationPool $WebAppPool -ApplicationPoolAccount (Get-SPManagedAccount $WebAppPoolAccount) -DatabaseServer $WebAppDatabaseServer -DatabaseName $WebAppDatabaseName    

write-host “New Web Application successfully created”

write-host “—————————————-”

write-host “Application name ” $webAppName -foregroundcolor Green

 

Sample PowerShell Script for deleting a web application in SharePoint 2010

$WebAppUrl=”http:/servername:port”

write-host “Begin Deleting Web Application at ” $WebAppUrl

write-host

Remove-SPWebApplication -Identity $WebAppUrl

write-host “New wEb Application successfully deleted”

Sample PowerShell Script for Creating Site Collection in SharePoint 2010

if($args)

{

$sitename=$args[0]

$siteurl=”http://servername:port/sites/” + $SiteName

write-host “Begin Creating Site Collection at ” $SiteUrl

write-host

$NewSite = New-SPSite -Url $SiteUrl -OwnerAlias Administrator -Template STS#1 -Name $SiteName

$RootWeb=$NewSite.RootWeb 

$RootWeb.Title=”Scripted Site -” + $SiteName

$RootWeb.Update()

write-host “New Scripted Site successfull created”

write-host “Title: ” $RootWeb.Title -foregroundcolor Green

}

else{
write-host “Error : You must supply parameter for site name” -foregroundcolor Red

}
 For Deleting the SiteCollection

if($args)

{

$sitename=$args[0]

$siteurl=”http://servername:port/sites/” + $SiteName

write-host “Begin Deleting Site Collection at ” $SiteUrl

write-host

Remove-SPSite -Identity $siteurl

write-host “New Site successfully deleted”

}

else

{

write-host “Error : You must supply parameter for site name” -foregroundcolor Red

}

 

Save the script files with the extension .ps1

To run them

./filename.ps1

Few other important PowerShell command (Get-Help, Get-Location, Set-Location)

Calling WCF Service in Plugin in CRM


Suppose this is our simple WCF Service.

[ServiceContract]
   public interface IService1
   {
       [OperationContract]
       string GetData(); 
     
   }

public class Service1 : IService1
   {
       public string GetData()
       {
           return “Hello World”+DateTime.Now.ToLongTimeString();
       }
     
   }

Now if we add its service reference in our plugin and then deploy it, while running we would receive this error.

Could not find default endpoint element that references contract ‘ServiceReference1.IService1’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

The reason for this is because the configuration information for the WCF service from the client side is missing. As class library won’t have their own config file.

Suppose if we add service reference to the above Service in a windows application, we can find the following information being added to the app.config file

<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
    <!–<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name=”BasicHttpBinding_IService1″ closeTimeout=”00:01:00″
                    openTimeout=”00:01:00″ receiveTimeout=”00:10:00″ sendTimeout=”00:01:00″
                    allowCookies=”false” bypassProxyOnLocal=”false” hostNameComparisonMode=”StrongWildcard”
                    maxBufferSize=”65536″ maxBufferPoolSize=”524288″ maxReceivedMessageSize=”65536″
                    messageEncoding=”Text” textEncoding=”utf-8″ transferMode=”Buffered”
                    useDefaultWebProxy=”true”>
                    <readerQuotas maxDepth=”32″ maxStringContentLength=”8192″ maxArrayLength=”16384″
                        maxBytesPerRead=”4096″ maxNameTableCharCount=”16384″ />
                    <security mode=”None”>
                        <transport clientCredentialType=”None” proxyCredentialType=”None”
                            realm=”” />
                        <message clientCredentialType=”UserName” algorithmSuite=”Default” />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address=”http://localhost:58844/Service1.svc” binding=”basicHttpBinding”
                bindingConfiguration=”BasicHttpBinding_IService1″ contract=”ServiceReference1.IService1″
                name=”BasicHttpBinding_IService1″ />
        </client>
    </system.serviceModel>–>
</configuration>

So now in case of our plugin we need to define the binding and endpoint information programmatically, something like this

try

{

BasicHttpBinding myBinding = new
BasicHttpBinding();

myBinding.Name = “BasicHttpBinding_IService1”;

myBinding.Security.Mode = BasicHttpSecurityMode.None;

myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;

myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;

myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

EndpointAddress endPointAddress = new
EndpointAddress(http://localhost:58844/Service1.svc&#8221;);

ServiceReference1.Service1Client myClient = new ServiceReference1.Service1Client(myBinding, endPointAddress);

MessageBox.Show(myClient.GetData());

}

catch (Exception EX)

{

 

throw EX;

}

      
 

This way we would be able to access our WCF service inside plugin.

Hope it helps !

The current identity “domain\username” does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files’.


To reslove this error,

i first tried registering ASP.NET 2.0

1. Open a command prompt.
2. Navigate to ‘C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\’
3. Run this: aspnet_regiis.exe -i

Followed by adding the “domain\username” to the “IIS_IUSRS” group.

This resolved the error.

.NET Framework missing from Visual Studio 2010 new project dialog box


To resolve this issue, download and install .NET Framework 3.5 sp1.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7&displaylang=en

Or if it is Windows Server 2008 R2,  just enable the .NET Framework 3.5.1 Features using Server Manager or else you will get the following error

“You must use role management tool to install or configure Microsoft .NET Framework 3.5”

Bye.

Using OrganizationServiceClient in CRM 2011


 Add Service Reference to the Organization WCF service in the application.

URL àhttp://servername:port/OrganizationName/xrmServices/2011/organization.svc 

Use the following code to perform various functions using OrganizationServiceClient 


Entity myContact = new Entity();

myContact.LogicalName = “contact”; 

AttributeCollection myAttColl = new AttributeCollection();

myAttColl.Add(new KeyValuePair<string, object>(“lastname”, “Rana”));

myContact.Attributes = myAttColl;
ClientCredentials credentials = new ClientCredentials();

Uri organizationUri = new Uri(http://servername:port/organizationname/xrmServices/2011/organization.svc&#8221;);

try
{
OrganizationServiceClient orgClient = new OrganizationServiceClient();
 

orgClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(“username”, “password”, “domain”); 

orgClient.Create(myContact);

}
catch (Exception ex)
{

throw ex;

} 

Hope it helps.