Friday, September 7, 2012

I was working with external list and was trying to access some of the items. But then i get to know that when you want to access the list items of external list, you cannot use ID field. You need to use BdcIdentity field to work with these items.Another point that i noted after getting those items is that you have to iterate items by using SPListItemCollection and inside that SPFieldsCollection for that item to get values of the fields. you directly cannot get the value.I hope this helps.

Wednesday, August 29, 2012

I encountered this error when I was developing an application for one of the site collection. I gave site collection URL while selecting farm solution that I was creating.Suddenly when deploying the application through Visual Studio 2010 I encountered this error and then I came to know that this error came in because a user under which I opened the Visual Studio did not have site collection administrative permission or at least site full access.Once I gave permission, I was able to deploy it successfully. Silly!! but sometimes it is helpful tip. Isn't it?

We are done
with writing our code. It’s time to register the project with strong name. Go
ahead in property of this project and give it a strong name.

Now right
click the CustomDesignerWorkflowActivity project and add SharePoint mapped
folder.

Select Template-1033-Workflow

Now we need
to add .actions file which is very important from Designer stand point.

Add new item
in the workflow folder and give a name as DesignerCustomActualActivity.actions

This is the
file which actually tells SharePoint to make this action available in Designer.

Now add this
XML in that file.

<?xml version="1.0" encoding="utf-8" ?>

<WorkflowInfo>

<Actions Sequential="then" Parallel="and">

<Action Name="Create Contact List"

ClassName="DesignerCustomActualActivity.CreateContactListType"

Assembly="DesignerCustomActualActivity, Version=1.0.0.0,

Culture=neutral, PublicKeyToken=5e36fcb66a91895d"

AppliesTo="all"

Category="SPKings Activity">

<RuleDesigner Sentence="Contact List Name %1 in %2 within site %3.">

<FieldBind Field="ContactListName" Text="Contact List Name"

DesignerType="TextArea" Id="1"/>

<FieldBind Field="WebName" Text="Web Name"

DesignerType="TextArea" Id="2"/>

<FieldBind Field="SiteUrl" Text="Url of base site" Id="3"

DesignerType="TextArea"/>

</RuleDesigner>

<Parameters>

<Parameter Name="ContactListName" Type="System.String, mscorlib"

Direction="In" />

<Parameter Name="WebName" Type="System.String, mscorlib"

Direction="In" />

<Parameter Name="SiteUrl" Type="System.String, mscorlib"

Direction="In" />

</Parameters>

</Action>

</Actions>

</WorkflowInfo>

If you
observe closely, we have defined action in tag and inside it we registered our
assembly and defined our own category. We can have the same name in category
whenever we create our custom actions so that all our custom action comes under
that category.

Then we set
the rule designer and in that we have bounded our all three properties with
their data type. Then we set the same three as parameters as input because we
will be setting the properties.

Now we need
to add these into the package. So double click on the package in the project
and then click on advanced.

Now add
assemblies. You can get this info from GAC If you deploy this application’s DLL
in GAC, from there you can get public key token information and then register
it here.

If you get an
access denied while dragging DLL to assembly or not able to install even
through gacutil, then deploy the solution, you will get that in assembly and
from there you can get it.

Just a handy
tip, there is one more way to get public key token if you do not want to deploy
the DLL in GAC and then get the token. Read this post.

Now one more
change left and that needs to be done in web.config file of web application. Open
up the web.config file of your web application from wss\virtual directory
folder and find a tag Authorized Type and add our custom assembly information
as mentioned below.

Now build the
application and then deploy the application. It’s time to test our custom
action in action and to see if it has appeared in designer.

Open
designer, connect with the site. Create workflow and click on actions. Here we
are with our own custom action.

Click on the
create contact list action and we get this. These come from the action file
that we created.

Set up the
parameters. Save and publish the workflow.

And set up a
workflow to run on item adding. Add the item and see the list gets created in
the web name you have mentioned in the designer. Execute method gets called
when this action gets executed.

Thursday, July 5, 2012

Now when I was developing a custom application for
SharePoint and needed to assign it with strong name I assigned a strong name to
my project. Now was the time to see the token generated for it. I went ahead
and tried to drag that assembly to GAC but I got access denied.

Development machine is Windows Server 2008. Now I tried
installing it using GACUTIL but I got the same result even being the
administrator of the machine.

Challenge comes in when you want to know the public key
token that has been generated for the project so that you can make modification
in web.config file.

So here is a solution. We will create an external command
that will get us the public key token of the project. So that when that command
is clicked we get to see result in command window.

Follow these simple steps. Make sure about spacing and
parameters shown here.

Friday, June 22, 2012

Earlier we
saw what Document ID is. If you have not read the post about Document ID in SharePoint 2010, I
would strongly recommend you reading it first before reading this post.

Once you have
fair understanding on document ID, this is the next step on generating your own
document ID in SharePoint 2010.

First
question that comes into mind is why would we need to generate custom document
ID?

Well, the answer is simple. If you have any specific requirement to
generate ID based on some department, some functions inside your organization
which helps you to search for document easily plus taking an advantage of
document ID feature so that even if the document is moved anywhere across the
site collection, you can use the same URL that is generated for document.

First thing
to note is that we need to use Microsoft.Office.DocumentManagement namespace
which has a class called DocumentIdProvider.

In this class
we need to override three methods and one property.

1)GenerateDocumentId - Method – This is the method where we will
actually generate our own document ID

3)GetSampleDocumentIdText - Method – Default Document ID value that will be
shown in the search web part as a part of help.

4)DoCustomSearchBeforeDefraultSearch – Property – If set to true,
then it will call the GetDocumentURLsById method before search or if set to
false, then it uses SharePoint search before custom methods.

Now let’s go
ahead and create a class that inherits from DocumentIDProvider and writes these
methods.

Go ahead and
create a project and add a reference to DocumentManagement namespace.

And here is
the entire code of the class

Note: Replace
Name with Title property of web to get the title of web.

We have
written code in respective methods based on the summary that we have noted
earlier for each method and property above.

Now we are
done with one part. Next, we need to register this custom document id with the
site collection via feature. So go ahead and create a feature scoped at site
collection level.

Now go ahead
and add the event receivers for this feature.

Remember we
would be applying our custom document ID generator when we activate this
feature and when we de activate this feature we want SharePoint to use default
generator back again.

So we are
going to write code only in two methods activated and deactivating.

Before
deploying change the property on activate feature default to false by going to
the properties settings of the feature.

Now build the
project and deploy the package.

Open the site
and go to the site collection feature. Make sure that Document ID service
feature is turned on.

Also
activates the feature that we have deployed.

Now go to
Document ID settings under site collection administration options.

And you will
notice that it says custom document id provider has been configured for this
site collection.

And there you
go once you upload documents, you get new DocumentID generated by your custom
code.

When you turn
the feature off, it sets back to default Document ID provider.

Monday, June 18, 2012

SSP is shared
service provider and that was available in MOSS 2007. In MOSS days, there were
certain actions that can only be performed only if you have created the SSP
like the BDC and User profiles.

Now we all
must be thinking that why SSP is removed from SharePoint 2010 version? Well
there are many aspects to this.

First assume
that you are going to have different web application and you would only need to
work with BDC and do not want to use any other service that comes under BDC,
but still just to use one BDC service you need to create two SSP that means two
separate databases.

Another thing
is in SSP we did not have items which are in similar nature. They all performed
different operations.

It is little
difficult to deploy the SSP on servers.

Because there
are too many services in one database, so it becomes difficult to scale it. It
did not support scaling as we could not add any extra service to the SSP.

Now in
SharePoint 2010 SSP has been replaced by Service Applications. These services
are not groups under anything, they all run independently. In other sense,
service applications provide a-la-carte options to choose from. Per web
application, you can configure which service you want to consume.

You can also
publish these services outside of the current farm so that these services can
also be used elsewhere. You need trust relationship between those farms who
wants to consume these services.

You can also
write your own services and add that service to this service application.

Here service
applications have their own databases unlike shared database in MOSS 2007 SSP.

You can use PowerShell
commands to play around with these services.

Get-SPServiceApplication returns
all service applications.
Get-SPServiceApplication-name {servicename} to get the service object.

From there
you can get all other properties related to the service.

Bottom line
is SSP services are now split into individual services and can be consumed from
web applications as and when needed. These services are:

Profiles, Audiences
= People Service App

Search = Search
Service App

Performance Point =
Performance Point Service App

Excel = Excel
Service App

Office Web
Applications = Office Web App

Visio Services =
Visio Service App

Word = Word Service
App

PowerPoint =
PowerPoint Service App

Project Server =
Project Server App

Here are some
new services that have been introduced in the SharePoint 2010.

Wednesday, June 13, 2012

If you have
not gone through Part -1 and Part -2 of this series, I would recommend you
reading it first and then continue reading from here.

Let’s go ahead
and add form actions to data form web part.

Open the page
that we had left opened in our previous post also open the list in browser. We
are going to add email field to the list. I have entered some dummy email
addresses to the list items.

Open
SharePoint Designer page and add email field to the data form web part.

Now keeping
cursor in email field, right click and then select insert column to right.

Now keeping
cursor in that column, go to insert tab and select SharePoint controls, form
action control button.

The moment
you select the button, it asks you what you want to perform when button is
clicked. We are going to select custom action.

So what
happens is it generates a workflow that is not associated with the list, nor
associated with site or not even with list item. It is independent workflow
that can be triggered by the button.

It generates
a workflow named form actions workflow 1.

Locate the
property of button and change the text of button to send email.

Now we need to
make one more change because we are going to send an email to Email field
mentioned in that specific list item, hence we first need to convert that field
into a label so that we can make the reference of that field in the workflow.

So select the
email field, right click that field and select format item as a label and then
save the field.

Now locate
the Form actions workflow 1 under workflows tab and open it to modify.

Select action
- send an email.

And select
these users for email and then select workflow lookup for user

Once you are
done with this and if you have email server properly set up, then you should be
able to send an email by clicking on that button which will send email to Email
field mentioned in that list item.

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com

SiteMeter

Bookmark US

Disclaimer

The opinions expressed on this blog are the personal views of SharePointKings, and do not represent or reflect the viewpoints or policies of any past, present, or future employer, colleague, or customer, or any other entity. The posts on this blog are provided ‘as is’ with no warranties, express or implied, and confer no rights. Use of information contained within this blog, including specific technical steps mentioned herein, is at your own risk. References to specific software products, processes, resources, or companies do not imply any endorsement.