SharePoint 2010 Error when creating list view - sharepoint

I have a custom list definition created via visual studio 2010. I would like to create a calendar view of this list using the web interface. When I attempt to create the view however, I am greeted with a helpful error message of:
Error
Cannot complete this action.
Please try again.
About the problem:
When I attempt to duplicate this error while running Fiddler2, I see a response of 404 Not Found when attempting to access /_vti_bin/owssvr.dll?CS=65001 using the HTTP POST verb.
No errors are logged in the ULS logs.
If I create a new custom list and attempt to reproduce the issue by adding two date columns and creating the calendar view, everything works as expected.
The schema.xml file defining the list is fairly large, with close to 25 fields.
I am using custom templates for the new, edit, and display forms.
I have defined a new custom view showing a subset of the columns in schema.xml
Does anyone know of any "gotchas" or things to look for in my list definition that could be related to this issue at all?
Has anyone encountered this issue before, and know of a way to fix it?
Failing those, what more can I do to debug this?
To avoid overflowing this question with large code blocks, you can view my list definition here:
Elements.xml - http://pastebin.com/97ucAedZ
Schema.xml - http://pastebin.com/2brpMJgT
ListInstance Elements.xml - http://pastebin.com/gnCXVpmh

I agree with moontear. I think your Content Type ID is invalid. If you are building off a Custom List template, I would expect your Content Type ID to be:
<ContentType ID="0x0100781A2C74BF4bfd81AE710DB1EACAE745"
Name="$Resources:Item"
Group="$Resources:List_Content_Types"
Description="$Resources:ItemCTDesc"
Version="1">
To inherit from Item, you should have 0x01 then 00 followed by a Guid. You have the right number of characters, if you use 00 instead of 70.
For more information, see Content Type IDs.

In cases like this, i usually take these steps:
Create List/View manually in MOSS.
Export list as template and try to
find out what is wrong in my
template.
Start with clean template, add one field etc at a time, test, repeat until error emerges.
Your xml seems ok, so i think it will be another MOSS 'gotcha' or 'aha' moment.

Related

How can I make Content Items without a CommonPart appear in the content list?

I created a custom Type that has a UserPart attached to it.
According to this issue on GitHub you can't add a CommonPart to content that also has a UserPart because it causes a StackOverflowException but I would still like items of my custom Type to show up in the content list. I already store CreatedUtc and PublishedUtc in the custom PartRecord, can I manually plug these in somewhere?
EDIT: For clarification, my specific scenario is that I am building a public facing Orchard website based on existing data that was used in a private application up to this point. I have a legacy table with user accounts that need to be mapped to Orchard Users but they also represent travel agencies that visitors should be able to browse and that Orchard admins should easily be able to edit and create through the Dashboard. I got the idea to create a TravelAgency type with a UserPart from Sipke's webshop tutorial
Content Types do not require to have a CommonPart to show in the Content List. If i remember properly its done by triggering the Creatable() in your migrations.
Also if you have a UserPart, you could Lazy loaded or just reference it via Foreign Key.
Why would you like something like that to be part of the Content List? I usually keep my business-specific Content Types tucked away in a nice section, so there are easier to visualise and use for users.
There is definitely a bug but as they comment you could extend taxonomies to accomplish your task and keep in mind sometimes changing the Orchard Codebase might fit your purposes, you only have to keep track of your changes when you upgrade next time. I have done it a couple of occasions to fit my projects.
If i remember properly, its been a while.. If you look in the core code where the Content List is created it looks for Creatable() Types. digging even more inside the code, chances are the Query in charge will join the CommonPart, hence your problem. You could easily add another query in the controller and add whatever you are after. The problem though, will be refactoring the rest of actions to accommodate your your type too. Way easier isolating your new Type. had to look at it for you, check this baby: Orchard.Core.Contents.Controllers.AdminController

One custom display form for all the lists

Good day to you. I am newbie in SharePoint 2013 so please bear with me. I have created around 15 lists in my website each containing same columns but different data (they differ semantically).
I am aware that we can change the default view, edit and display form for each list by creating new form in SharePoint Designer 2013. This seems like a very bad approach as far as the maintenance is concerned. I know my lists are exactly the same so why do I have to create same 15 display forms for each of the lists?
Is there a way to create one custom Display form (may be in a central location, i don't know i am just thinking :P ) for all the lists? Is there a way to tell a list to use a specific display form? Any help will be highly appreciated. Thanks.
If i understand your question correctly, you have 15 lists with same set of columns. You want to change the display/look of the form. All 15 lists should have same look and feel right!! If yes, then why don't you try with some html, javascript solution. Since you are in sharepoint 2013, javascript support for solutions is very good like rest queries. You can use SPServices also.
If you want to to add data to the list whenever you click on the "New Item" link in the list then hijack this link such that it should navigate to your custom form. Pass your list name as query parameter. Whenever user is saving the form, get the list name from the query parameter and save the data to that list.
There could be another ways also to achieve the solution with html and javascript.
Useful links:
Microsoft, Microsoft, SPServices
Sam I think you can create a custom content type and create custom display form for your content type. Enable the content type in each of your lists so automatically this customized form would be available.
The advantage of this approach is that suppose if you need one more list after some time you can just add this content type and your form would be available into the new list as well.
The approach is explained in the link below.
http://blogs.msdn.com/b/varun_malhotra/archive/2009/06/06/define-custom-new-edit-display-forms-for-content-types.aspx
Check this one also
https://joshmccarty.com/2011/02/sharepoint-custom-list-with-custom-content-types-and-custom-display-forms/
Just wanted to write the solution which I implemented as it might help others as well. (Thanks Hiren and Mihir for your valuable inputs)
I had 15 lists and I was showing the data to the user using content search web part with custom display template. All of the lists were using the same display template so I made a new page just to show the item details. In the display template I pointed the item URL (i hijacked the list name and the current item id) to my new page and displayed the item. Let me know if anyone is interested in the whole solution or further elaboration is required.

Change template html in sharepoint discussion reply box

I have a wss 3.0 install which needs an "anonymous" discussion board. I can modify the view so no usernames are displayed, however when I click on "reply", the message I'm replying to shows up in the rich text box with the username of the previous poster.
Is there a way to remove that username? or Remove the previous posted text altogether? I've found the schema.xml file with lots of relevant info under the ..12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, but not sure if this is the easiest way to adjust this setting.
Any comments appreciated.
Best practice says that you should always create a custom list definition instead of trying to modify the OOB assets.
The easiest way to do this is take a copy of the 12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, modify the feature Ids and names so that its unique. Then your free to change the schema render template (i.e view schema) and modify the edit and display forms.
If you need to modfify the actual entry form you may consider a custom control template : http://msdn.microsoft.com/en-us/library/aa543922.aspx
Custom list definition : http://msdn.microsoft.com/en-us/library/ms466023.aspx
Agrothe,
I have a similar requirement (hide or mask the author inside the reply thread.). What exactly inside of schema.xml do you think will allow you to do accomplish that?
Not sure if the list forms are exposed to xslt. If so, then perhaps this is another approach.
FWIW, the other solutions I have investigated:
(1) A custom event handler. Unfortunately, I can't pinpoint which event fires when someone click reply.
(2) Anonymous blog comments (http://blogs.msdn.com/sharepoint/archive/2007/08/06/anonymous-comment-feature-for-sharepoint-blog-now-available-on-codeplex.aspx).
(3) the other thing I am considering, is to introduce a global anonymous active directory login, which users can use to post anonymously. Not ideal, but for the amount of time I have spent researching a solution, might be my last hope.

How to identify an unsafe web part / control

I get an error when trying to edit a page in a SharePoint site. Using WinDbg I see that actual error is:
Microsoft.SharePoint.ApplicationRuntime.SafeControls+UnsafeControlException
This looks to me like I have a control on the page which is not included in the <SafeControls> section of web.config. I've had a look at the aspx file for the page, but I can't see any controls on there which don't have a reference in web.config.
Digging a little deeper (and using Sosex.dll) I got the following data from the callstack which lead up to the error:
0:013> !mframe 03
0:013> !mdv
Frame 0x3: (Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(System.Guid)):
[A0]:this:0xc00c03e8 (Microsoft.SharePoint.ApplicationRuntime.SafeControls)
[A1]:guid:{ef2d8253-a451-56da-be1d-5f32d5227173} VALTYPE (MT=0000064278430ea8, ADDR=000000000308caa0) (System.Guid)
[L0]:null (System.Type)
[L1]:0x633c50 (System.String) STRVAL=The type could not be found or it is not registered as safe.
[L2]:null (System.Type)
So it looks like I've found the GUID of the control ([A1]) which is causing the problem. Howver, I don't know of a way to find which control this GUID is referencing. There must be a table somewhere in SQL Server whih stores this information? I've already tried dbo.WebParts, selecting against tp_ID with the GUID, but it found nothing. I guess I'm missing something?
Whoa there! Back slowly away from the SQL Server ;)
First thing to look at is the difference between a closed web part and a deleted web part.
Closed is the menu operation you get when not in "Edit Page Mode" and it simply hides the web part from view - SharePoint still attempts to load its assembly and you will get errors if there is no corresponding safe control entry.
If this is the problem then the easy way to delete it is to put ?contents=1 on the end of the URL and the page will open in Maintenance Mode.
Hope this helsp!
To manipulate Web parts programmatically, you can use SPLimitedWebPartManager
See this article to find the idea of how you would remove or locate webpart from page.
With debugger it should be fairly easy to list all those webparts and just see coressponding DisplayTitle for your particular ID.
Using reflector I found this is how they generate the GUID for each control:
internal static Guid GetTypeId(MD5HashProvider md5Provider, Type type, string assemblyName)
{
byte[] bytes = new UnicodeEncoding().GetBytes(assemblyName + "|" + type.FullName);
return new Guid(md5Provider.GetHash(bytes));
}
So if you really want to find it, run through every assembly and type and match the GUID.
Good luck. I have the same problem. I plan on removing one control at a time until I pin down which one it is.

Saving a document to SharePoint brings up "Web File Properties" dialog with incorrect metadata

Situation:
A custom "Master Document" content type inherits from Document
The "Master Document" content type has five additional choice fields
There are five custom "Document Template" content types that inherit from the "Master Document" content type
Each of the "Document Template" content types uses a different Word document template (.dot) file
Each of the "Document Template" content types have been added to a document library
Problem:
I click on a document in the library
Document opens up in Word 2003 for me to edit
I make some changes and save
A box pops up called "Web File Properties". The window contains all of my custom metadata properties and the ContentType field. The ContentType field is set correctly to the current content type. The other fields are reset to their default values. This same window can apparently be opened by going to File -> Properties
This window by itself would be fine except for two reasons:
It includes the ContentType column
All of my custom metadata properties are visible but are reset to their default values instead of whatever values were previously selected. This means, every time the user wants to save the document, they have to remember what properties were tagged and set them back.
Question:
Can I disable this Web File Properties box?
If no... can I get the fields that show up to be populated to their correct values?
If no... is there a way to disable my fields from displaying in this window?
If no... is this a SharePoint page that I can modify?
***Edit with some more information***
It looks like this only happens in Office 2003 and looks like it affects Choice fields. If I create the same column as a Lookup field, it seems to work.
Edit again
Looks like if the lookup field is a multi-select field then it will not show up in the Web File Properties box at all (single select lookups still work).
edit 10/14/2009
Link to the KB Article mentioned below by Brenda:
http://support.microsoft.com/kb/971500/
This is more of a workaround rather than an answer but I figured I might as well put it here in case it helps someone else.
It seems as if these issues with the Web File Properties box is specific to Office 2003. The issues I reported above seem to be fixed in Office 2007.
If you want to get it working in 2003 and you have choice/lookup fields in your Document content type, here is the summary:
Single select Choice fields DO NOT work
Multi select Choice fields DO work
Single select Lookup fields DO work
Multi select Lookup fields DO NOT work
FYI - I want to CORRECT my previous post. The fix DID FIX my problem after I deleted my internet cache. Works PERFECT now. Here is the KB you need: KB971500 I can email you the fix if you can't find it. The notes in the document do not describe the problem exactly as I would have, but it was the fix for my case.
bhartson#lbrealty.com
We have the EXACT problem. I've opened a case with Microsoft back in February and they were able to finally duplicate my problem.
I have been kept informed and told that my fix would be available with the JUNE cumulative upates. I just received a specific hotfix from my Microsoft rep and applied it and it still did NOT fix my problem. I am hoping he gave me the wrong one and has the real one to send me.
Thanks for your post. I'm may try some of your suggestions above but I just want Microsoft to fix this. We can't upgrade to Office2007!
Thanks.
man, this was really killing me, I spent an entire day recreating document libraries and all sorts of content-types and variations of my excel template before I figured this was a bug... At least MS has a little hotfix request thing now... they're going to send it to me I guess :\
I didn't test this in excel/office 2003 and really botched a presentation of our little workflow... embarassing... always test with the app & environment people are going to use!!!
thanks for the KB article number

Resources