Tuesday, 30 November 2010
Sharepoint Solution Debug or Release build
Tuesday, 23 February 2010
Behind the scene: Property promotion in Infopath
<xsf2:listPropertiesExtension>
<xsf2:fieldsExtension>
<xsf2:fieldExtension columnId="{afd78356-f9c9-4211-8167-7d7d70dc67fd}" readWrite="no" columnName="{E28D210E-FF60-401D-A63A-40AECE533A43}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{26612320-1611-4f71-9197-0382144f7b9a}" readWrite="no" columnName="{32F2028F-BEF8-4B2C-AAE4-9F0753930D7A}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{1DAB9B48-2D1A-47b3-878C-8E84F0D211BA}" readWrite="no" columnName="{5A28EC4B-B173-466F-8814-849B4F932146}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{7cfc7f24-852d-4f78-b1b2-e0e68176d9ba}" readWrite="no" columnName="{D9F232A3-DD04-4B4D-9813-9E15E6549AB7}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{c4e0f350-52cc-4ede-904c-dd71a3d11f7d}" readWrite="no" columnName="{A04C8AD0-074F-4160-8577-E298532A11BA}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{1DAB9B48-2D1A-47b3-878C-8E84F0D211BA}" readWrite="yes" columnName="{0ACC2AC8-0890-496B-B524-D6FA0498C818}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{260962da-788e-458a-82a5-e03bb7f6dc52}" readWrite="yes" columnName="{051DFADD-706C-411B-9A4E-7ABA223CAEA9}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{212ec377-84c6-4c00-ad22-2cab2550fb50}" readWrite="yes" columnName="{00BF28EE-3601-42BA-A1F1-24C74B5A9B35}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{2fdeded3-4b03-47af-8ac6-ca411d5603d4}" readWrite="yes" columnName="{91BB41AA-AD25-4C47-BFE8-E04F175F5AC2}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{bb97a85d-0ee4-46ef-b1f1-0748cfa4c137}" readWrite="yes" columnName="{B463F993-2DAF-47E7-83D0-FD3837044858}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{475a6571-ba0e-4d56-9364-d2ac728a323b}" readWrite="yes" columnName="{8B0055A4-7AE8-4C8F-882C-F0C5E01C90C4}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{fce73a96-7bfa-44e9-8d1b-25d4aaa449ca}" readWrite="yes" columnName="{9535DA33-113B-4091-89AB-4ADC104A0F13}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{2958362e-25af-4d8e-9938-50622a1c0e61}" readWrite="yes" columnName="{C8ECE69F-C5C9-47AF-8E40-17CE03D7F5C4}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{0f26d0d9-9f4f-4de6-829d-a1994b26f7d7}" readWrite="no" columnName="{62A5E596-8726-4BBA-862C-3298BAB6808F}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{19b6647c-8672-46f4-b4da-60c74da4cb04}" readWrite="no" columnName="{F086DE11-7848-40B4-95C4-B1A3CCE1374D}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{9930e1c1-3067-47c1-ab8d-3eeb98679c3f}" readWrite="no" columnName="{B78D2E7D-C8AF-40BB-BAD4-D6D17156A91D}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{b1733cd8-b3ce-42a6-990a-0b9a5955da5c}" readWrite="yes" columnName="{BABE6BC6-F248-4E36-8B86-215345352F89}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{5e295b7a-4849-464e-9d56-92bef86869eb}" readWrite="yes" columnName="{25CF762C-D3BB-4F01-BEA8-7F76C4E09914}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{7f358004-05e4-42ac-9fde-a253039e19ce}" readWrite="yes" columnName="{58E519A7-7FA5-4D37-BF5D-F3057BB2D719}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{33a7da72-2997-4ebf-ad89-9603a478fad2}" readWrite="yes" columnName="{DFB32035-E22F-4EA7-8ED7-D36EFC99586A}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{5571ace5-1274-4388-b2e6-02ea6c3c7c76}" readWrite="yes" columnName="{22D6961D-13BD-465F-8C30-FEF5B0FFC0B0}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{230448c7-3b5b-40e1-8242-dba5c11656ad}" readWrite="yes" columnName="{14CB66B0-EA81-4B26-8ABF-E30C50B61DAB}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{7205c21c-5eae-44b1-9b0e-787bb36de370}" readWrite="no" columnName="{E6B623CF-F7CD-41D5-9059-EC84FD4AD026}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="" readWrite="no" columnName="{C08C7115-ED51-4445-985A-0C747741F8BB}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{eeccc9d8-3a7d-4fb9-9e12-3d72daa3c619}" readWrite="no" columnName="{C1EB52D6-7B01-4A00-BB60-F4279372861A}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{27d7764c-ccfc-433d-828d-56beb602062a}" readWrite="no" columnName="{5FA48CEA-E192-4854-B862-70DBBDAEDBDE}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{40577009-e6a2-44aa-b034-029c61e23f1d}" readWrite="no" columnName="{72522D66-2E9E-4BAA-9C84-8D9BF5F44A37}"></xsf2:fieldExtension>
<xsf2:fieldExtension columnId="{dc455fba-75ab-40e2-8a54-d83ad8d70a6a}" readWrite="no" columnName="{AC0CDC6B-C9B3-4E4A-B341-AC5CC6408CBD}"></xsf2:fieldExtension>
</xsf2:fieldsExtension>
</xsf2:listPropertiesExtension>
<xsf:listProperties>
<xsf:fields>
<xsf:field name="Reference" columnName="{D9F232A3-DD04-4B4D-9813-9E15E6549AB7}" node="/my:myFields/my:referenceNumber" type="xsd:string"></xsf:field>
<xsf:field name="Job Title" columnName="{A04C8AD0-074F-4160-8577-E298532A11BA}" node="/my:myFields/my:jobTitle" type="xsd:string"></xsf:field>
<xsf:field name="Status" columnName="{0ACC2AC8-0890-496B-B524-D6FA0498C818}" node="/my:myFields/my:status" type="xsd:string"></xsf:field>
<xsf:field name="Business Unit" columnName="{C8ECE69F-C5C9-47AF-8E40-17CE03D7F5C4}" node="/my:myFields/my:businessUnit" type="xsd:string"></xsf:field>
<xsf:field name="Annual Salary" columnName="{62A5E596-8726-4BBA-862C-3298BAB6808F}" node="/my:myFields/my:annualSalary" type="xsd:double"></xsf:field>
<xsf:field name="Country" columnName="{F086DE11-7848-40B4-95C4-B1A3CCE1374D}" node="/my:myFields/my:country" type="xsd:string"></xsf:field>
<xsf:field name="Assigned To" columnName="{BABE6BC6-F248-4E36-8B86-215345352F89}" node="/my:myFields/my:assignedTo" type="xsd:string"></xsf:field>
<xsf:field name="FDGroup Name" columnName="{25CF762C-D3BB-4F01-BEA8-7F76C4E09914}" node="/my:myFields/my:FDGroupName" type="xsd:string"></xsf:field>
<xsf:field name="HRGroup Name" columnName="{58E519A7-7FA5-4D37-BF5D-F3057BB2D719}" node="/my:myFields/my:HRGroupName" type="xsd:string"></xsf:field>
<xsf:field name="MDGroup Name" columnName="{DFB32035-E22F-4EA7-8ED7-D36EFC99586A}" node="/my:myFields/my:MDGroupName" type="xsd:string"></xsf:field>
<xsf:field name="CEOGroup Name" columnName="{22D6961D-13BD-465F-8C30-FEF5B0FFC0B0}" node="/my:myFields/my:CEOGroupName" type="xsd:string"></xsf:field>
<xsf:field name="Submitter Login Name" columnName="{14CB66B0-EA81-4B26-8ABF-E30C50B61DAB}" node="/my:myFields/my:submitterLoginName" type="xsd:string"></xsf:field>
<xsf:field name="Division" columnName="{E6B623CF-F7CD-41D5-9059-EC84FD4AD026}" node="/my:myFields/my:division" type="xsd:string"></xsf:field>
<xsf:field name="Last Modified Login Name" columnName="{C1EB52D6-7B01-4A00-BB60-F4279372861A}" node="/my:myFields/my:LastModifiedLoginName" type="xsd:string"></xsf:field>
<xsf:field name="Current Salary" columnName="{5FA48CEA-E192-4854-B862-70DBBDAEDBDE}" node="/my:myFields/my:currentSalary" type="xsd:double"></xsf:field>
<xsf:field name="Staff Name" columnName="{72522D66-2E9E-4BAA-9C84-8D9BF5F44A37}" node="/my:myFields/my:candidateName" type="xsd:string"></xsf:field>
<xsf:field name="Currency" columnName="{AC0CDC6B-C9B3-4E4A-B341-AC5CC6408CBD}" node="/my:myFields/my:salaryCurrency" type="xsd:string"></xsf:field>
</xsf:fields>
</xsf:listProperties>
There is an unclosed literal string. Line 1, position 411.
System.Xml.XmlException: There is an unclosed literal string. Line 1, position 411.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Office.InfoPath.Server.Xml.InfoPathXmlDocument.Load(XmlReader reader)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObject.<>c__DisplayClass3.<.ctor>b__0()
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics.ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObject..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObjects.<>c__DisplayClass2.<.ctor>b__0(EnhancedBinaryReader innerReader, DataObject& newObject)
at Microsoft.Office.InfoPath.Server.Serialization.EnhancedBinaryReader.ReadObjectMap[KeyT,ValueT](Dictionary`2 map, ItemReaderDelegate`1 readKey, ItemReaderDelegate`1 readValue)
at Microsoft.Office.InfoPath.Server.Serialization.EnhancedBinaryReader.ReadObjectMap[ValueT](Dictionary`2 map, ItemReaderDelegate`1 readValue)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObjects..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState.DesterilizeVersion1(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState.CreateFromByteArray(Byte[] serializedSessionState, Byte[] serializedVersionState, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionStateManager.GetSessionState(HttpContext context, String editingSessionID, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.LoadFromSession(HttpContext context, SPSite contextSite, EventLogStart eventLogStart, Solution solution)
at Microsoft.Office.InfoPath.Server.Controls.PostbackPage.<>c__DisplayClass1.
Thursday, 10 December 2009
How to Create new sharepoint site
Step 1: Open sharepoint Central Administration and click Application management as shown in the picture bellow.
Step 2: Choose the ‘Create of Extend Web Application’ link from ‘Sharepoint Web Application Management’.
Step 3: Click ‘Create a new Web application’ link
Step 4: Create Web application form will pre-populate all fields. You can choose the default value in most cases. Note the port number. You will need this to access the site. If you want to access using more readable name, create a DSN entry for your site and use that as host header in the following form. I’ve choose Network Service account for Application pool authentication. It’s a preferable option for me, and I would suggest you to use it. If want more restricted access you can specify the username and password. Form will pickup the default content database server name from sharepoint farm configuration. Click okay when you are happy with the information.
Step 5: Step 4 creates a web end point to attach your website to. You actual site has not been created yet. If you try to brow the url as you just created, it will show an error message. Site is not available yet. This step will create the site. Sharepoint come with a bunch of template to create your site from. Go to Application Management and Click ‘Create Site Collection’ in sharepoint site management section.
This will take you to Create Site Collection page.
Step 6: In Create site collection page, choose the web application you want to add the site. (shown in red circle in following diagram).
Choose a suitable title for your site. This title will be displayed in almost every page of your site. Add a description. This description will be displayed in the home page. Choose the template for your site. Following example shows team site template. You can choose whatever template is suitable for your purpose. Click ok and your site is ready to use( off course you have to wait for the working icon to stop J).
Monday, 30 November 2009
Finding Program Equivalent of Share point UI Actions
You will need .NET developers Bramastra(The ultimate wepone), the Red Gate's .NET Reflector. you can download this from http://www.red-gate.com/products/reflector/
Now you are ready for the discovery of your lifetime.
We will run through the steps using an example. In our case lets say we want to find out how to remove a workflow association with no new instance option. If you directly look in the SPWorkflowAssociation class, there is a remove association option but it does not have a option for No New instance. We are going to find it how Sharepoint does it.
Before we start, let's list out all the location where to look for web pages source and assemblies:
- Web pages:
- \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
- \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN
- Assemblies
- \WINDOWS\assembly
- \Inetpub\wwwroot\wss\VirtualDirectories\[yourwebsitename or port]\_app_bin
We can find this file in \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
Open this file in any text editor.
Lets open the assembly using Reflector. We can find the assembly in \Inetpub\wwwroot\wss\VirtualDirectories\[yourwebsitename or port]\_app_bin. In our case the assembly name is Microsoft.SharePoint.ApplicationPages.dll
After you drill down to the Microsoft.SharePoint. ApplicationPages.RemWrkflPage class and BtnSubmit_Click event handler the code looks like as shown in the image on the right side.
If we look carefully, we ca see that for No New Instance option it's simply setting association.Enabled = false;
So that's the magical thing. We have to disable the association instead of removing it.
We are done!
And using the same approach you can discover all functionality, as long as an example is available.
A bit of caution, some MOSS functionality is not developed using managed code. You wont be able to see code for those functionality.
Thursday, 27 August 2009
Job failed with the following error. This job will be skipped. Failed to connect to an IPC Port: Access is denied.
stsadm.exe -o execadmsvcjobs
Executing .
Executing SharePoint Worker Process Group Updatefaab8d3e-048c-42b1-80d8-63ab5451da0d.
The SharePoint Worker Process Group Updatefaab8d3e-048c-42b1-80d8-63ab5451da0d job failed with the following error. This job will be skipped. Failed to connect to an IPC Port: Access is denied.
Operation completed successfully.
This can be result of multiple things. Some of the thing is specified in http://fnoja.blogspot.com/2007/08/failed-to-connect-to-ipc-port-access-is.html blog.
In short you need to check following:
- open services management console(services.msc) and check if 'Windows SharePoint Services Administration' service is running. If not start it. Make sure service log-on credential are correct.
- Check if the 'Windows SharePoint Services Timer' service is running and with write credential. This user will need access to the database server as well.
- And if your Sharepoint server accessing the database using local service, then the machine is added to the database as sysadmin.
Monday, 10 August 2009
STSADM error message
"The Web application at 'http://yourserver:port/Approval Requests' could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."
Reason:
Apparently Sharepoint gives this error message if you try to run stsadm remotely. There are lots more cases when you will get same message, this is just one.
Solution:
1) run command locally.
2)Alternatively run command using psexec. Just create a batch file with the stsadm command to execute. Then execute the batch file with psexec with a administrator user id and password.
Example: copy following line to delete.bat file
stsadm.exe -o gl-deletelistitem -url "http://yourserver:port/Approval Requests"
Above line uses powershell command to delete all contents of a list 'Approval Requests'. You can download powershell from http://stsadm.blogspot.com/2009/02/downloads.html.
Then run following command from any workstation to execute above batch file remotely to sharepoint server.
psexec.exe \\sharepointServer -u yourdomain\sharepointAdmin -p password C:\batchfilelocation\delete.bat'
yourdomain\sharepointAdmin should also an administrator to the sharepoint database.
Friday, 10 July 2009
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications
"This solution contains resources scoped for a Web application and must be deployed to one or more Web applications."
One of such scenarios described here with possible solution.
I was trying to deploy a workflow having InfoPath form on it. But in development machine I don't have MOSS installed. I copied all sharepoint( and sharepoint-workflow) dlls locally. This build fine. No compilation error.
But when I was creating WSP package using WSPBuilder it was giving a warning message:
"Could not resolve: Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Please define the -DLLReferencePath with the path to the referenced assemblies. However a SafeControl tag for the WorkflowCode.MyWorkflow class has been created."
If you deploy this solution using command line tool in MOSS it gives "This solution contains resources scoped for a Web application and must be deployed to one or more Web applications." error message.
You can still configure this solution from administration UI.
There are two ways to fis this:
1) simply GAC the dll in you development machine. This willl ensure you don't get the warning message in package creation and no error on deployment either.
2) depending on the reference dll's and their trust level WSP builder creates as safe control list. Now when the above dll is not gac'ed WSP builder creates
To deploy this package correctly either delete safe control list manually from the manifest file. Manifest file is located inside generated WSP file.
Alternatively set the "-BuildSafeControls false" in the wspbuilder configuration.
This may not be the best option, but it's solves the issue.