Quantcast
Channel: Microsoft Techies
Viewing all 430 articles
Browse latest View live

Web Config Modifications using PowerShell in SharePoint 2010

$
0
0
Web Config Modifications using PowerShell
Add-PSSnapin Microsoft.SharePoint.PowerShell
$oWebApp = Get-SPWebApplication http://SP2010
$oWebApp.WebConfigModifications
$oWebConfig = New-Object -TypeName Microsoft.SharePoint.Administration.SPWebConfigModification
$oWebConfig.name = "add[@key='TEST']"
$oWebConfig.path = "/configuration/appSettings"
$oWebConfig.value = "<add key='TEST' value='My Test' />"
$oWebConfig.owner = "oTest"
$oWebConfig.sequence = 0
$oWebConfig.type = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
$oWebApp.WebConfigModifications.Add($oWebConfig)
$oWebApp.Update()
$oWebApp.Parent.ApplyWebConfigModifications()
GO to C:\inetpub\wwwroot\wss\VirtualDirectories\80
Open Web.config file, Search with "TEST", you will able to see <add key='TEST' value='My Test' />

How to Move content Databases using PowerShell

$
0
0
How to Move content Databases using PowerShell?
—————————–
Step1: Create an additional content database either using PowerShell (PS) or the UI namely:
Go to CA > Application Management > Manage Content Databases > Add a Content Database (I called my content database “WSS-Content-NewUserDB”).
Now we will Use PS
Syntax:
———-
PS C:\Users\Admin> Move-SPSite [-Identity] -DestinationDatabase [-
AssignmentCollection ] [-Verbose] [-Debug] [-ErrorAction ] [-WarningAction ] [-ErrorVariable ] [-WarningVariable ] [-OutVariable ] [-OutBuffer ] [-WhatIf] [-Confirm]
Eample:
——–
PS C:\Users\Admin> Move-SPSite -Identity http://sp2010 -Destinationdatabase WSS-Content-NewUserDB
Confirm
Are you sure you want to perform this action?
Performing operation “Move-SPSite” on Target “http://sp2010?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”): y
WARNING: IIS must be restarted before this change will take effect.
Now you have to restart IIS.
open a command prompt window and type iisreset.

Microsoft.SharePoint.PowerShell

$
0
0
Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell” | format-table name > C:\SP2010_PowerShell_Commands.txt
And
Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell” | select name, definition | format-list > C:\SP2010_PowerShell_Commands_new.txt

How to open Windows PowerShell

$
0
0
The use should have permission on SharePoint_Shell_Access, if not Adds a user to the SharePoint_Shell_Access role for the specified database.
How to add user to SharePoint_Shell_Access?
Go to Security–>logins–>[Domain\MyName]
Right click–>properties.
Click on User Mapping.
Select “SharePoint_Config” database in the —–Users Mapped to this login section:
Select “SharePoint_Shell_Access” in the —Database role membership for :SharePoint_Config

On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt (that is, PS C:\>), type the following command, and then press ENTER:
Restore-SPFarm -Directory -RestoreMethod Overwrite -Item [-BackupId ] [-Verbose]
Note:
If you are not logged on as the Farm account, you are prompted for the Farm account’s credentials.

How to get SharePoint Server Version

$
0
0
SharePoint Server Version
Open PowerShell:
PS C:\Users\My Name>(get-spfarm).buildversion
You will get Version

Or
PS C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>(get-spfarm).buildversion
Major Minor Build Revision
----- ----- ----- --------
14 0 6100 5002
Or
To see which build your products are, go to Central Administration > Upgrade and Migration > Check Product and patch installation status.
Or
http://SERVER/_admin/PatchStatus.aspx
Data Base Version:
Central Administration --> System Settings -->Manage servers in this farm
You can see:
Configuration database version: 14.0.6100.5002
Configuration database server: SREVER
Configuration database name: SharePoint_Config
Or
To see which build your databases are, go to Central Administration > Upgrade and Migration > Review database status.
Or
http://SERVER/_admin/DatabaseStatus.aspx

Migration from SharePoint 2010 to SharePoint 2013

$
0
0
1. Go to sql management studio and your databse right click db-->Tasks-->detach go to C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA(2files ".mdf and .ldf" files take)
2. go to 2013 server sql management studio -->attach both .mdf and ldf files
3. Create ur webapplication in 2013 site collection-->if any custom solutions,webparts etc add your site
4.using Powershell: Mount-SPContentDatabase -Name WSS_Contenet_2010 -WebApplication "http://webapp:2013"

SharePoint 2013 Best Practices

$
0
0
http://social.technet.microsoft.com/wiki/contents/articles/12438.sharepoint-2013-best-practices.aspx

Move/Migrate SharePoint list items/documents and preserve metadata properties

$
0
0

In moving the mass documents to other folder or libraries there is a pretty common way by using Windows Explorer view. But there's a drawback to that method as the metadata properties like document properties get updated in the process - manily the modified Date/Time as well as the user would take on the role of the person that 'Last modfied '. This also applies to copying list data in the data sheet view from one list/library to another.

I have figured out a new way to doing this where you can save the current list properties after moving the documents as a template with content included and redeploying that to other location. 

So if you want to move the contents of a SharePoint Document Library or List and be able to preserve the item’s metadata/property values at the same time you should use this method:

The process to move the content of a SharePoint Document library or List and be able to preserve the item's metadata/property values at the same time you should use this method:

1. Create a Blank Document library where you want to move, don't worry about the custom field it will automatically created once document moved.

2. Go to to "Content and Structure" page. You can access this item within the site with Site Actions  >Site Settings then under Site Administration tab there is a option called Content and Structure.


3. Navigate to you Source Library and select the view that you would like to have moved. Then click on  View > Select the view . Then Click on Action > Move...

   Note: You can create you own custom view. Example You want to move 30 days old file. So  create your view which show files for only 30 Days.


 4. You'll then be prompted witha pop-up that will let you navigate to your destination library or Document library .After you find that, just press the OK button

SharePoint Administration Interview

$
0
0
What timer job is responsible for propogating changes to SharePoint configuration objects across the farm?

HiddenListFullSyncTimerJob

Which of the following logs is not intended to be read directly in SharePoint 2010?

Which of the following is not a scope for SharePoint features?

How should the User Profile Synchronization Service be configured via PowerShell?

By default, what TCP ports are used for PowerShell v2 remoting (non-SSL/SSL)?

The AssignmentCollection parameter is available on all SharePoint cmdlets. Which of the following cmdlets actually utilize assignment collections?


True or False: If a cmdlet parameter specifies that it takes a *PipeBind object, it will always be set by output from previous cmdlets in the pipeline.

What downloadable package contains PowerShell and other Windows Management components?

Which one of the following shows a call of a static method?

True or False: SharePoint Service Application Proxies only connect to SharePoint Service Applications (in SharePoint 2010 or 2013).

Which method must you call to persist changes to a SPPersistedObject to the configuration database?

Which of these machine-local groups are added by SharePoint?

True or False: Switch parameters and Boolean parameters are specified the same way in PowerShell cmdlets.

What method must be called to push web.config modifications added to a SPWebConfigModificationCollection to web applications?

What SPN prefix is used to identify service accounts for PowerShell CredSSP authentication?

Which of the following objects are not derived from SPPersistedObject?

Objects from which of the following object frameworks are not treated as first-class objects in PowerShell? First class objects can have their members (properties and methods) invoked directly via dot notation.

What is the root object of the SharePoint object model?

Which of the following are children of SPFarm?

Which version of PowerShell is the minimum required for SharePoint 2013?

Additional details about webs, lists, and list items are stored in a hashtable member of these objects named:

SharePoint 2010

$
0
0
Plan managed metadata (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ee530389.aspx



Managed metadata overview (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ee424402.aspx



SharePoint 2010 – Provisioning User Profile Synchronization

http://blogs.msdn.com/b/russmax/archive/2010/03/20/sharepoint-2010-provisioning-user-profile-synchronization.aspx



Configure profile synchronization (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ee721049.aspx



User Profile service overview (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ee662538.aspx



User Profile Replication Engine overview (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/cc663011.aspx



Create, edit, or delete a User Profile service application (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ee721052.aspx



Maintain profile synchronization (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ff681014.aspx



User Profile Synchronization Service unexpected failure - Events 6300-6309 (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ff519523.aspx



User Profile Synchronization service not started (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ff519522.aspx









Windows PowerShell for SharePoint Server 2010

http://technet.microsoft.com/en-us/library/ee662539.aspx



SharePoint 2010 Products administration by using Windows PowerShell

http://technet.microsoft.com/en-us/library/ee806878.aspx



SharePoint Foundation 2010

http://technet.microsoft.com/hi-in/library/cc288070(en-us).aspx  



Initial configuration (SharePoint Foundation 2010)

http://technet.microsoft.com/en-us/library/ee837435.aspx  



Prepare to host sites (SharePoint Foundation 2010)

http://technet.microsoft.com/en-us/library/cc303306.aspx  



SharePoint Server 2010

http://technet.microsoft.com/hi-in/library/cc303422(en-us).aspx



Upgrading to SharePoint Server 2010

http://technet.microsoft.com/en-us/library/cc303420.aspx  



Perform an in-place upgrade (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/cc303423.aspx  



Upgrade in place to SharePoint Server 2010

http://technet.microsoft.com/en-us/library/cc263212.aspx  



Troubleshoot upgrade issues (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/cc262967.aspx  



Resume upgrade (SharePoint Server 2010)

http://technet.microsoft.com/en-us/library/ff382638.aspx  



Configure automatic password change (SharePoint Foundation 2010)

http://technet.microsoft.com/en-us/library/ff607826.aspx  



Configuring Kerberos authentication for SharePoint 2010 Products (white paper)

http://technet.microsoft.com/hi-in/library/ff829837(en-us).aspx  



Video demos and training for SharePoint Server 2010

http://technet.microsoft.com/hi-in/library/cc262880(en-us).aspx

How to know the target platform of an .Net assembly

$
0
0
If you want to know about dll in which platform will run.
I am assuming your assembly has available in GAC
Open GAC folder
How to open GAC folder.
Click start
Click run
Type: assembly
Now it will open GAC folder
Or: C:\Windows\assembly
This is the path of GAC
Now in the GAC folder, you can see all dlls
Select any dll, you will windows propert: Processor Architecture
If it is x86 mean it will run in 32 bit environment
If it is x64 mean it will run in 64 bit system
If it is MSIL, it will run in both 32 and 64 systems (Any CPU).

ArrayList class is not type-safe, why?

$
0
0

A)ArrayList class is not type-safe because it can store any object.
Ex:
var integers = new ArrayList();
integers.Add(1);
integers.Add(2);
integers.Add("3");

for (int i = 0; i < integers.Count; ++i) {
    int integer = (int)integers[i];
    // do something
}


The above will compile because the value "3", even though it's a string and not an integer, can legally be added to an ArrayList since String derives (like Int32) from Object. However, it will throw an InvalidCastException when you try to set integer to (int)integers[2] because a String cannot be cast to an Int32.

C# Interview Concepts

$
0
0
Introduction to C#
Introduction
Setup
What is .Net
What is the CLR
What is FCl
What is C#
Hello, world
The compiler
Hellp, VIsual Studio
Editing C#
Debugging C#
Types
Classes and objects in C#
Introduction
Class Definitions
Classes and Objects
Constructors
Objects and Variables
Reference types
OOP
Encapsulation
Access Modifiers
Statics
Types and Assemblies
Introduction
Reference types
Value Types
Method parameters
Structs and enums
Immutability
Arrays
Assemblies
Members: Methods, Events, and Properties
Introduction
Methods
Fields and properties
An overview of events
Delegates
Events redux
Flow Control
Introduction
Branching
Switching
Looping
Jumping
Exceptions
Common exceptions
Try and catch
Try, finally, using
Custom exceptions
Object Oriented Programming
Introduction
Pillars of OOP
Inheritance
Polymorphsim
Abstact Classes
Interfaces
Common Interfaces

http://csharp.net-tutorials.com/

static void Main(string[] args)

$
0
0
The first word is static. The static keyword tells us that this method should be accesible without instantiating the class.

static Class:
If a class is static,  it can have static members, both functions and fields. A static class can't be instantiated, so in other words, it will work more as a grouping of related members than an actual class. You may choose to create a non-static class instead, but let it have certain static members. A non-static class can still be instantiated and used like a regular class, but you can't use a static member on an object of the class. A static class may only contain static members. 
Ex:
publicstaticclass Rectangle
{
publicstaticint CalculateArea(int width, int height)
{
return width * height;
}
}

The next keyword is void, and tells us what this method should return. For instance, int could be an integer or a string of text, but in this case, we don't want our method to return anything, or void, which is the same as no type.
The next word is Main, which is simply the name of our method. This method is the so-called entry-point of our application, that is, the first piece of code to be executed.
string[] args After the name of a method, a set of arguments can be specified within a set of parentheses. In our example, our method takes only one argument, called args. The type of the argument is a string, or to be more precise, an array of strings.

How To Read Input From Console in C#


SharePoint Create list item using javascript

C# Constructors & Destructors

$
0
0
Constructors 
By default each class will have Constructor with it's class name.
Ex: If i create a class with name Car.
class Car
{
}

one Constructor will create as below..
 public Car()
        {
         
        }

If you want to change anything inside Constructor, you can change it as below..

 public Car()
        {
            Console.WriteLine("Constructor with no parameters called!");
        }


Constructors are special methods, used when instantiating a class. A constructor can never return anything, which is why you don't have to define a return type for it. A normal method is defined like this:

public string Describe()

or

public Car()

Constructor can be overloaded as well, meaning we can have several constructors, with the same name, but different parameters.

overloaded: with the same name, but different parameters

public Car()
{

}

public Car(string color)
{
    this.color = color;
}

A constructor can call another constructor, which can come in handy in several situations. Here is an example:
public Car()
{
    Console.WriteLine("Constructor with no parameters called!");
}

public Car(string color) : this()
{
    this.color = color;
    Console.WriteLine("Constructor with color parameter called!");
}


Destructors

Since C# is garbage collected, meaing that the framework will free the objects that you no longer use, there may be times where you need to do some manual cleanup. A destructor, a method called once an object is disposed, can be used to cleanup resources used by the object. Destructors doesn't look very much like other methods in C#. Here is an example of a destructor for our Car class:

~Car()
{
    Console.WriteLine("Out..");
}
If you run this code, you will see that the constructor with no parameters is called first. This can be used for instantiating various objects for the class in the default constructor, which can be called from other constructors from the class.

C# Override

$
0
0
Same method name and same signature.
If you want to override any function, you have to add virtual key word, and while overriding, you have to use override key word.
Ex:

publicclass Vehicles
{
publicvirtualvoid Greet()
{
Console.WriteLine(
"Hello, I'm some sort of vehicles!");
}
}

publicclass Car: Vehicles
{
publicoverridevoid Greet()
{
Console.WriteLine(
"Hello, I'm a car!");
}
}

In the above example, Car class has inherited Vehicles.
Like this we can inherit hierarchy wise. ex:
publicclass Accord: Car
{
publicoverridevoid Greet()
{
Console.WriteLine(
"Hello, I'm a Accord!");
}
}

Accord class is inheriting Car..like this we can add more..

But we can't do multiple inheritance in C#
Ex: Accord class can't inherit Car and Vehicles.

C# abstract class

$
0
0

Abstract classes, marked by the keyword abstract in the class definition, are typically used to define a base class in the hierarchy. What's special about them, is that you can't create an instance of them - if you try, you will get a compile error. Instead, you have to subclass them, as taught in the chapter on inheritance, and create an instance of your subclass. So when do you need an abstract class? It really depends on what you do. 


namespace AbstractClasses { class Program { staticvoid Main(string[] args) { Dog dog =new Dog(); Console.WriteLine(dog.Describe()); Console.ReadKey(); } } abstractclass FourLeggedAnimal { publicvirtualstring Describe() { return"Not much is known about this four legged animal!"; } } class Dog : FourLeggedAnimal {
publicoverridestring Describe()
{
string result =base.Describe();
result
+=" In fact, it's a dog!";
return result;
}
} }

Abstract methods are only allowed within abstract classes. Their definition will look like a regular method, but they have no code inside them: 

abstractclass FourLeggedAnimal
{
publicabstractstring Describe();
}
So, why would you want to define an empty method that does nothing? Because an abstract method is an obligation to implent that very method in all subclasses. In fact, it's checked at compile time, to ensure that your subclasses has this method defined. Once again, this is a great way to create a base class for something, while still maintaining a certain amount of control of what the subclasses should be able to do. With this in mind, you can always treat a subclass as its baseclass, whenever you need to use methods defined as abstract methods on the baseclass. For instance, consider the following example: 

namespace AbstractClasses
{
class Program
{
staticvoid Main(string[] args)
{
System.Collections.ArrayList animalList
=new System.Collections.ArrayList();
animalList.Add(
new Dog());
animalList.Add(
new Cat());
foreach(FourLeggedAnimal animal in animalList)
Console.WriteLine(animal.Describe());
Console.ReadKey();
}
}

abstractclass FourLeggedAnimal
{
publicabstractstring Describe();
}


class Dog : FourLeggedAnimal
{

publicoverridestring Describe()
{
return"I'm a dog!";
}
}

class Cat : FourLeggedAnimal
{
publicoverridestring Describe()
{
return"I'm a cat!";
}
}
}


As you can see, we create an ArrayList to contain our animals. We then instantiate a new dog and a new cat and add them to the list. They are instantiated as a Dog and a Cat respectively, but they are also of the type FourLeggedAnimal, and since the compiler knows that subclasses of that class contains the Describe() method, you are actually allowed to call that method, without knowing the exact type of animal. So by typecasting to the FourLeggedAnimal, which is what we do in the foreach loop, we get access to members of the subclasses. This can be very useful in lots of scenarios.

C# Enumerations

Viewing all 430 articles
Browse latest View live